[jboss-user] [Performance Tuning] - Re: Best JVM memory size?

PeterJ do-not-reply at jboss.com
Mon Feb 19 21:50:38 EST 2007

Actually, if you allocate 1GB of heap, it will never all be used.  For example, with a young generation of 300MB, once the heap size reaches 700MB, on the next GC a full GC will be done. Why? Because the Sun JVM makes the pessimistic assumption that all objects in the young generation will survive and thus overflow into the tenured generation, and in this case the tenured generation would overflow, therefore a full GC is performed. Therefore, 300MB of the allocated heap are never used. So that 300MB does not count towards the memory allocation; if it is swapped out, who cares? Actually, while the OS might reserve that memory, it might not ever allocate it, though it will count that memory towards total memory allocation.

By the way, I verified this behavior in the 1.4.2 JVM, and I think that it is still the same in 1.5, not sure about 1.6 though.

Another, probably more accurate estimate, would be to bring up the system and see how much memory is taken by services and the OS. Then allocate a heap size to what is left over.  For example, when running FC 6 on my laptop with 2GB ram, I am using about 300MB memory for the OS and services. Thus the maximum JVM heap I would want to use is 1.7GB (2GB - 300MB).  But like all tuning settings, this is simply an estimate for an initial size. One then has to take various measurements under load, and analyze those results, to find the optimal settings.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019151#4019151

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019151

More information about the jboss-user mailing list