Re: Question on JVM memory in tomcat
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kees Jan, Kees Jan Koster wrote: > The memory drops every 18 hours because the system had locked up with > OOME's and I reboot it. Sorry, that wasn't clear from the graph: it looked like a continuous JVM heap graph with a healthy curve. Knowing that there is a crash and reboot in there clears everything up. > What is a MiB, how is it different from MB? A MiB is a "real" megabyte (2^20 bytes), rather than a "fake" one (10^6 bytes) that has long been co-opted by the hard disk manufacturers to sell more space than is actually there. Basically, it's a "real" MB. http://en.wikipedia.org/wiki/MiB > Hmm. Good point [about setting -Xmx == -Xms]. Especially on machines > that have no other tasks than running that particular JVM. Either that or JVMs that you expect to have long running times and have been tuned to serve the expected load. Generally, any production server IMO. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklJz30ACgkQ9CaO5/Lv0PCLgwCggZiTbSmUpJmoVhIghV5UEYm0 2ssAn3d6LzCnwKEQ40EsZ6EgNPNaYTj7 =BOIJ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on JVM memory in tomcat
Dear Chris, I just wrote a small post about memory leaks http://java-monitor.com/forum/showthread.php?t=150 In that post I also talk about the difference between maximum memory and committed memory. Note that in the memory usage graph you show, the leak is certainly not "easy to spot". In fact, that memory graph looks perfectly healthy to me: lots of little GCs and a full GC every 18 hours or so. The reason the memory curve looks good to me is that, after every full GC, the amount of used memory is lower than the previous full GC. Unless you have the graph labeled incorrectly, this graph looks good to me. PS MarkSweep "overtakes" PS Scavenge late on the 12th because the JVM is doing a full GC, rather than the frequent incremental GCs that it always does. This does not "signal an impending out of memory situation". Uhm. The memory drops every 18 hours because the system had locked up with OOME's and I reboot it. On top of that, the memory is filled up to well over 90% of the max memory. In systems that fill up and then use full gc's to remedy it, the memory allocation usually peaks around 80% or so. I have a graph that looks pretty much just like yours: used memory bounces between 30MiB and 160MiB with a fixed maximum of 192MiB, incremental GCs all the time which makes the long-view of the graph seem "fuzzy", and full GCs every 30 hours or so. The full GC takes the used memory from ~160MiB all the way down to maybe 40MiB (that's a lot of garbage!). This went on for 6 weeks until I decided to stop graphing it because I was convinced that my new memory settings were sufficient (I had recently run out of memory when running with the default 64MiB heap). This is what I see on anther host. Nothing to worry about, indeed. What is a MiB, how is it different from MB? I *do* recommend setting the min and max heap sizes to the same value: this allows the JVM to used fixed generation sizes and not waste its time re-allocating and re-arranging the whole heap whenever it's going to expand it. If you don't need a huge heap, why even set it as the maximum? If /do/ need a huge heap, why not allocate it all at once? Hmm. Good point. Especially on machines that have no other tasks than running that particular JVM. -- Kees Jan http://java-monitor.com/forum/ kjkos...@kjkoster.org 06-51838192 Human beings make life so interesting. Do you know that in a universe so full of wonders, they have managed to invent boredom. Quite astonishing... -- Terry Pratchett - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on JVM memory in tomcat
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kees Jan, Kees Jan Koster wrote: >> JVM >> Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB > > As David pointed out, this is probably measured against the committed > memory, not the max memory. I believe that "committed" and "total" are identical. From the above info, it looks like the JVM is using about 70MB of it's own heap. If you asked top or ps what the JVM was using, it would say 111MB + whatever non-heap memory has also been allocated. [OT from here on out] > I just wrote a small post about memory leaks > http://java-monitor.com/forum/showthread.php?t=150 In that post I also > talk about the difference between maximum memory and committed memory. Note that in the memory usage graph you show, the leak is certainly not "easy to spot". In fact, that memory graph looks perfectly healthy to me: lots of little GCs and a full GC every 18 hours or so. The reason the memory curve looks good to me is that, after every full GC, the amount of used memory is lower than the previous full GC. Unless you have the graph labeled incorrectly, this graph looks good to me. PS MarkSweep "overtakes" PS Scavenge late on the 12th because the JVM is doing a full GC, rather than the frequent incremental GCs that it always does. This does not "signal an impending out of memory situation". I have a graph that looks pretty much just like yours: used memory bounces between 30MiB and 160MiB with a fixed maximum of 192MiB, incremental GCs all the time which makes the long-view of the graph seem "fuzzy", and full GCs every 30 hours or so. The full GC takes the used memory from ~160MiB all the way down to maybe 40MiB (that's a lot of garbage!). This went on for 6 weeks until I decided to stop graphing it because I was convinced that my new memory settings were sufficient (I had recently run out of memory when running with the default 64MiB heap). I *do* recommend setting the min and max heap sizes to the same value: this allows the JVM to used fixed generation sizes and not waste its time re-allocating and re-arranging the whole heap whenever it's going to expand it. If you don't need a huge heap, why even set it as the maximum? If /do/ need a huge heap, why not allocate it all at once? > You could hook your Tomcat up to Java-monitor. Java-monitor tracks you > memory usage over two days, so you can see how the memory usage develops > over time. The graphs in the post are made with Java-monitor. Or you could use a spreadsheet and not publish your usage data to the world. :( - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklFK+MACgkQ9CaO5/Lv0PAeAwCfRnv0VhQtaEoMFqbyXGyMoc5U PogAoIYWJ5h6jd1Uk9O8T+ZRZ+jRISnd =4ZJH -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on JVM memory in tomcat
Dear user080701, I am using the tomcat manager to monitor the health of the tomcat server. I found that the session of JVM, it shown the following information: JVM Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB As David pointed out, this is probably measured against the committed memory, not the max memory. I just wrote a small post about memory leaks http://java-monitor.com/forum/showthread.php?t=150 In that post I also talk about the difference between maximum memory and committed memory. Is my tomcat in good condition or not? It seems that the free memory is only 38.13MB? I have added the following lines in my startup.sh export JAVA_HOME=/opt/jdk export JAVA_OPTS=-Xmx1536m export CATALINA_HOME=/opt/tomcat How to know whether my tomcat can use the memory or not? You need some form of monitoring that plots max, committed and used memory over time, rather than give you samples in numeric format. You could hook your Tomcat up to Java-monitor. Java-monitor tracks you memory usage over two days, so you can see how the memory usage develops over time. The graphs in the post are made with Java-monitor. To use Java-monitor just register on the Java-monitor forum and download the probe once you are logged in. -- Kees Jan http://java-monitor.com/forum/ kjkos...@kjkoster.org 06-51838192 The secret of success lies in the stability of the goal. -- Benjamin Disraeli - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on JVM memory in tomcat
Caught one of my own flaws in that one right after I sent it. Total memory - free memory is what's actually being used. Total is what's been reserved before. If free memory goes to zero, the jvm adds memory to the total up to max memory. If you're worried about memory consumption, just watch total as it compares to max. In your case you aren't even using 10% the max. --David David Smith wrote: > My limited understanding, but free memory is memory the JVM has used > before and freed up. In your case, total memory probably went up to > 149.31 MB at one point, then memory was freed creating that 38.13 MB > free memory. If the sum of Free and Total add up to max, I would worry > since that implies at some point, the total memory actually hit max. If > this machine has other things going on, you might want to consider > watching it for a while and then trimming back the max memory. > > There are some people on this list with a phenomenal understanding of > the JVM and all it's internals. I'm sure they'll correct me if I got it > wrong in any way. :-) > > --David > > user080...@hotmail.com wrote: > >> Hi, >> I am using the tomcat manager to monitor the health of the tomcat server. I >> found that the session of JVM, it shown the following information: >> >> JVM >> Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB >> >> Is my tomcat in good condition or not? >> >> It seems that the free memory is only 38.13MB? >> >> I have added the following lines in my startup.sh >> export JAVA_HOME=/opt/jdk >> export JAVA_OPTS=-Xmx1536m >> export CATALINA_HOME=/opt/tomcat >> >> How to know whether my tomcat can use the memory or not? >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- David Smith Programmer/Analyst College of Agriculture and Life Sciences Cornell University B32 Morrison Hall Ithaca, NY 14853 Phone: (607) 255-4521 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on JVM memory in tomcat
My limited understanding, but free memory is memory the JVM has used before and freed up. In your case, total memory probably went up to 149.31 MB at one point, then memory was freed creating that 38.13 MB free memory. If the sum of Free and Total add up to max, I would worry since that implies at some point, the total memory actually hit max. If this machine has other things going on, you might want to consider watching it for a while and then trimming back the max memory. There are some people on this list with a phenomenal understanding of the JVM and all it's internals. I'm sure they'll correct me if I got it wrong in any way. :-) --David user080...@hotmail.com wrote: > Hi, > I am using the tomcat manager to monitor the health of the tomcat server. I > found that the session of JVM, it shown the following information: > > JVM > Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB > > Is my tomcat in good condition or not? > > It seems that the free memory is only 38.13MB? > > I have added the following lines in my startup.sh > export JAVA_HOME=/opt/jdk > export JAVA_OPTS=-Xmx1536m > export CATALINA_HOME=/opt/tomcat > > How to know whether my tomcat can use the memory or not? > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Question on JVM memory in tomcat
Hi, I am using the tomcat manager to monitor the health of the tomcat server. I found that the session of JVM, it shown the following information: JVM Free memory: 38.13 MB Total memory: 111.18 MB Max memory: 1365.37 MB Is my tomcat in good condition or not? It seems that the free memory is only 38.13MB? I have added the following lines in my startup.sh export JAVA_HOME=/opt/jdk export JAVA_OPTS=-Xmx1536m export CATALINA_HOME=/opt/tomcat How to know whether my tomcat can use the memory or not?