-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Randeep,
On 1/23/14, 12:17 PM, Randeep wrote: > Thanks. That worked. Anything unusual? Garbage collection is > happening too often? > > [root@server logs]# cat > /usr/share/apache-tomcat-6.0.37/logs/heap.log 1.910: [GC > 16192K->1923K(260160K), 0.0150080 secs] 2.454: [GC > 18115K->3151K(260160K), 0.0137140 secs] 2.760: [GC > 19343K->3309K(260160K), 0.0058220 secs] 3.648: [GC > 19501K->4446K(260160K), 0.0062870 secs] 4.000: [GC > 20638K->5063K(260160K), 0.0080940 secs] 4.305: [GC > 21255K->6302K(260160K), 0.0060890 secs] 4.598: [GC > 22494K->6323K(260160K), 0.0062020 secs] 5.664: [GC > 22515K->7098K(260160K), 0.0055070 secs] 6.980: [GC > 23290K->8708K(260160K), 0.0176410 secs] 7.332: [GC > 24900K->12045K(260160K), 0.0179400 secs] 7.794: [Full GC > 24591K->12864K(260160K), 0.2538960 secs] 8.476: [GC > 29184K->14200K(260288K), 0.0080560 secs] 8.939: [GC > 30520K->15401K(260288K), 0.0407000 secs] 9.379: [GC > 31721K->16897K(260288K), 0.0099850 secs] 9.603: [GC > 33217K->16652K(260288K), 0.0649140 secs] 10.498: [GC > 32972K->17768K(260288K), 0.0068540 secs] 10.885: [GC > 34088K->18538K(260288K), 0.0084330 secs] 11.225: [GC > 34858K->19584K(260288K), 0.0071730 secs] 11.466: [GC > 35904K->20313K(260288K), 0.0050570 secs] 12.128: [GC > 36633K->20565K(260288K), 0.0042210 secs] 12.385: [Full GC > 26015K->20204K(260288K), 0.2847340 secs] 13.817: [GC > 36524K->22174K(260288K), 0.0155690 secs] 14.127: [GC > 38494K->25303K(260288K), 0.0816490 secs] 14.671: [GC > 41623K->27150K(260288K), 0.0436660 secs] 15.173: [GC > 43470K->28757K(260288K), 0.0140720 secs] 15.414: [Full GC > 32030K->28926K(260288K), 0.3071990 secs] 65.004: [GC > 45310K->31775K(260352K), 0.0105440 secs] [root@server logs]# Do what I do: write a Perl script to pull-apart the data from above into something useful, like CSV, and then use a spreadsheet to graph the data. Graphing heap data *really* helps. Looking at numbers is ... useless. - -chris > On Thu, Jan 23, 2014 at 10:33 PM, André Warnier <a...@ice-sa.com> > wrote: > >> Randeep wrote: >> >>> Hi all, Thanks a lot for valuable points. Here the information >>> you guys asked and the changes I made. >>> >>> OS : CentOS release 5.4 (Final) >>> httpd-2.2.3-65.el5.centos(front_end) +(mod_jk)+ >>> apache-tomcat-6.0.37 >>> >>> I installed httpd using yum. Downloaded tomcat from Apache as >>> compressed archive(tar.gz) >>> >>> I'm using following startup script. [root@server ~]# cat >>> /etc/init.d/tomcat6 #!/bin/bash # description: Tomcat Start >>> Stop Restart # processname: tomcat # chkconfig: 234 20 80 >>> JAVA_HOME=/usr/java/default export JAVA_HOME >>> PATH=$JAVA_HOME/bin:$PATH export PATH >>> CATALINA_HOME=/usr/share/apache-tomcat-6.0.37 case $1 in >>> start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh >>> $CATALINA_HOME/bin/shutdown.sh ;; restart) sh >>> $CATALINA_HOME/bin/shutdown.sh sh >>> $CATALINA_HOME/bin/startup.sh ;; esac exit 0 >>> >>> As you said, I removed the JAVA_OPTS declaration from >>> .bash_profile and I have created setenv.sh and set JAVA_OPTS in >>> it. [root@server bin]# pwd /usr/share/apache-tomcat-6.0.37/bin >>> >>> [root@server bin]# cat setenv.sh export JAVA_OPTS='-Xms256m >>> -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log' >>> >>> Now it shows in grep. [root@server bin]# ps aux | grep >>> Bootstrap root 1100 33.7 5.4 707052 95240 pts/0 Sl >>> 11:29 0:06 /usr/java/default/bin/java >>> -Djava.util.logging.config.file=/usr/share/apache-tomcat- >>> 6.0.37/conf/logging.properties >>> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager >>> >>> - -Xms256m >>> -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log >>> -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.37/endorsed >>> -classpath /usr/share/apache-tomcat-6.0.37/bin/bootstrap.jar >>> -Dcatalina.base=/usr/share/apache-tomcat-6.0.37 >>> -Dcatalina.home=/usr/share/apache-tomcat-6.0.37 >>> -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.37/temp >>> org.apache.catalina.startup.Bootstrap start root 1158 0.0 >>> 0.0 3932 692 pts/0 R+ 11:29 0:00 grep Bootstrap >>> [root@server bin]# >>> >>> But nothing came in heap.log. So I better monitor this and if I >>> get the OOM again I have to increase Max limit! >>> >> >> Maybe you should provide a full path for the -Xloggc option ? >> >> >> >>> >>> On Thu, Jan 23, 2014 at 8:50 PM, Christopher Schultz < >>> ch...@christopherschultz.net> wrote: >>> >>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA256 >>>> >>>> Randeep, >>>> >>>> On 1/23/14, 7:43 AM, Randeep wrote: >>>> >>>>> I'm getting out of memory exception errors. >>>>> >>>> :( >>>> >>>> Exception in thread "Timer-1" java.lang.OutOfMemoryError: >>>> Java heap >>>>> space at java.util.Arrays.copyOf(Arrays.java:2882) at >>>>> >>>>> java.lang.AbstractStringBuilder.expandCapacity( >>>> AbstractStringBuilder.java:100) >>>> >>>>> >>>>> at >>>> >>>>> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572) >>>>> >>>>> >>>>> >>>>> at java.lang.StringBuffer.append(StringBuffer.java:320) >>>> >>>>> at org.json.JSONArray.toString(JSONArray.java:834) at >>>>> org.json.JSONObject.valueToString(JSONObject.java:1359) at >>>>> org.json.JSONObject.toString(JSONObject.java:1233) at >>>>> com.xxx.xxx.servlet.WServlet.writeProgramJson(WServlet.java:503) >>>>> at com.xxx.xxx.servlet.WServlet$1.run(WServlet.java:414) >>>>> at java.util.TimerThread.mainLoop(Timer.java:512) at >>>>> java.util.TimerThread.run(Timer.java:462) >>>>> >>>> If you are trying to serialize huge JSON objects, this is >>>> going to happen. I'm not sure if JSON is as smart as the Java >>>> Serialization engine, but if you have a circular-reference in >>>> your object graph, I'd be willing to bet that the JSON >>>> serializer will run forever and exhaust your heap. >>>> >>>> It's also possible that you simply have a tiny heap and need >>>> more, especially if you aren't currently setting any heap >>>> parameters. >>>> >>>> Is there anyway to see currently set jvm heap size details? >>>> Any >>>>> linux commands. >>>>> >>>> You can attach any profiler to your app. Good luck catching >>>> this in the act, though, in production. >>>> >>>> You can also use "jmap -heap" which comes with the JDK. Just >>>> point it at a process and you'll get a heap summary from a >>>> running JVM. Make sure your JVM and jmap version match. >>>> >>>> I have tried creating setenv.sh and putting the new >>>> parameters in >>>>> it. but echo $JAVA_OPTS was not giving any value. >>>>> >>>> setenv.sh is run during Tomcat startup. Running "echo >>>> $JAVA_OPTS" from the command-line isn't going to reveal >>>> anything. What you want to do is modify setenv.sh, re-launch >>>> Tomcat, and then look at the process command line... >>>> something like this: >>>> >>>> $ ps aux | grep Bootstrap >>>> >>>> This should give you the whole command-line for Tomcat, and >>>> you can verify that your heap options have been set. >>>> >>>> So I have put in .bash_profile and run it. Then restarted >>>> tomcat6. >>>>> >>>> Don't do that: it will only work if you login using bash, and >>>> it won't work for other users you may have to restart >>>> Tomcat. >>>> >>>> this is the line I added in .bash_profile. >>>> JAVA_OPTS="-Xms256m >>>>> -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log" >>>>> >>>> You'll need to "export" JAVA_OPTS, otherwise it won't do >>>> anything for you. >>>> >>>> - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 >>>> Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG >>>> with Thunderbird - http://www.enigmail.net/ >>>> >>>> iQIcBAEBCAAGBQJS4TM+AAoJEBzwKT+lPKRYfB4QAMP4/MORiK92nK4kJ+KD9alc >>>> >>>> 2QYcriasb8QkPPgvYHGhGaxeLIprb1TE6tZdMSp08bHadDr+HpSbxi5xq9C6A1RJ >>>> fabHj9ShrXqdtTFiewPH3P/ulvaaJNPD1LeIFBwoG7/4vAIGKW48gLhaRUYcbe+z >>>> >>>> lV2NsZ18u38EZ9KRR8An66jX4PkwMXxl4QdQx5HDmuS/Sx8G7AfDVkuSB5PMNXbg >>>> TVlSEz5VeJnEGtBwnjgIa6ZSTv+iIv+nsw4WVuMe+4h1R07e1axxNismkgpUsU46 >>>> >>>> Ra4P7TssgdrqXFXmX4+kPNzd3xbbhPYIOOrQ0PYt6wGF0Wd9N1r/gvvViDbgghca >>>> wp39c3VJM8eE2vy9n0XCGYBkdq2DnRNVFV2y2xnfwecWKtDPEWfklTk8ZvbcAyxe >>>> >>>> hi3hxQnChCk74nxd/hvI1uNfgHcd/NwtmifwXPNM0BQCZ+AJarCbGca+a/BTTBaX >>>> txVIuIEf3jt/gpFu28UI8kt7Hx/PgWJ32QFyIPCbH5EYaSiKSz/Q6wCTvJTbUG4s >>>> >>>> GCK8AB/rGf1Z8efKlUZw2ESr1yX/VBCu9uOEK/60v+AAthiubq+O2ke1TzWKvy/I >>>> MxDhNiMo710w98h5hqIl5SthwXCgv3vEaaiUgDUV8zP3CoOtHL61NNZmLrMBTD2X >>>> >>>> 18aTMDKJ9BTvoYoZcmyV >>>> =IL2E -----END PGP SIGNATURE----- >>>> >>>> --------------------------------------------------------------------- >>>> >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>>> For additional commands, e-mail: >>>> users-h...@tomcat.apache.org >>>> >>>> >>>> >>> >>> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJS4VKbAAoJEBzwKT+lPKRYmOUQAMPRc0t2ABLeC9y0LsCh2G9N 1U0WmPvBzcZ9v5Goy+ZOMPVkPJgEQ1gaxXx9ygXPiGn3KlWGdJWYMJixZEyq+Nkd a+Mo8uFxf9XtaqfS7aDCdtomC19YNa9myFlyiS3QULYaUDPQAAmFP09TWQc4ccWB HWAp0jqns84RcZBasKU/nhpKv5rrjQxeInt9mcUaxPtBRR2qib8KQ59oFti8F3oN fBtDaVlPCp+dqRu0ftc5Oq74IONoxIzfrciuw9GU5GcBIAfGTxJskj/vhwIiB/Zf xJDzDGhpnlaYkKrWqqPSjg3vaOpVtASiHrYHJjHQv99Hu8L6N+razIT0z2tb0qFt OS6A/RiAOaijdT2ksQjv3B1xN7KGK8LxUqMSQXuYLXTIuHxKZJoHDxs1h5U2pHcF pFwDtjB8RmCo1ZXJJRY0QeHvrPG54J+5BarIJnKpOV+9AfF7xxgYxoxToVIsNaW0 ibYb7Lx0psj6jAGsr2rm0mMJk8ulUzRQU8azjJ5VmjtL6EpA9a2q3jXmbrT9JFo7 Lfr2jFmpYBckP4Iz0UWVz6uSfFcSts/AJJ9XHpINF1TP0epbedfyvPD49NFgrlAh /vJforXmboqR1CVHmWwwVPgXQJplu7Cwi1YDOTa244iIin/J7qtsDrxqvxCneHSY 9iLeufC3pbO74jtx0SZ+ =Zl2B -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org