Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Peak memory usage does not go beyond a limit

I see that with -Xmx2g, the peak memory reaches 1G and does major collections (marksweep collector). With -Xmx3g, it reaches 1.5G and does a major collections. With -Xmg4g, it reaches 2G and does major collections. But, from here I tried increasing max memory to 6G, 8G, 12G and all the times the peak memory reaches 2G does major collections.

How to make it use beyond 2G? I didn't come across any setting for this. Does -Xms matter here? Fo those -Xmx, I made -Xms half of -Xmx.

I am using Jetty, Java 1.6.024.

UPDATE: Yes, I am using 64-bit JVM. The JVM options I am using are: -Xmx6g -Xms3g -XX:MaxPermSize=256m The way I am determining the peak memory is by looking at the memory graph in JConsole. It reaches 2G and drops (major collection). Old Gen reaches 1.5G max and then drop happens.

Thanks, Prams.

like image 867
prams Avatar asked Apr 09 '12 22:04

prams


People also ask

How do I use peak memory?

We can also look for “VmHWM: Peak resident set size” to measure RAM usage. VmPeak is the maximum total memory usage, including virtual memory, while VmHWM is the peak RAM usage. As we know, /proc is a virtual filesystem, so reading from its files is not the same as reading from a normal filesystem.

What is peak MEM?

VmPeak is the maximum amount of memory the process has used since it was started. In order to track the memory usage of a process over time, you can use a tool called munin to track, and show you a nice graph of the memory usage over time.


1 Answers

You have three memory regions, eden, survivor and tenured space.

What I suspect is happenings is that either the tenured or eden spaces are not growing as you increase the maximum size.

The reason these two regions matters is that when the tenured space fills a Full GC is triggered (I suspect this size is growing) When the eden space fills and there is not enough space in the survivor space to copy all the objects left, a full GC is also triggered.

If this is the cause of your problem, you are creating a very large number of medium lived objects which is likely to be a performance problem, unless you can reduce the number created. An alternative is to specifiy a larger new size which increases the eden size.

Try -mx12g -XX:NewSize=10g - verbosegc

The last option will give your the sizes of the individual spaces when they are cleaned up.

like image 131
Peter Lawrey Avatar answered Oct 05 '22 13:10

Peter Lawrey