Alex Rivera | Logout

Can Sun JVM handle gigantic heap sizes without problems, and how?

Asked 2009-11-08T10:56:20.230
15

I have heard several people claiming that you can not scale the JVM heap size up. I've heard claims of the practical limit being 4 gigabytes (I heard an IBM consultant say that), 10 gigabytes, 32 gigabytes, and so on... I simply can not believe any of those numbers and have been wondering about the issue now for a while.

So, I have three part question I would hope someone with experience could answer:

  1. Given the following case how would you tune the heap and GC settings?
  2. Would there be noticeable hickups (pauses of JVM etc) that would be noticed by the end users?
  3. Should this really still work? I think it should.

The case:

  • 64 bit platform
  • 64 cores
  • 64 gigabytes of memory
  • The application server is client facing (ie. Jboss/tomcat web application server) - complete pauses of JVM would probably be noticed by end users
  • Sun JVM, probably 1.5

To prove I am not asking you guys to do my homework this is what I came up with:

  1. -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:-EliminateZeroing -Xmn768m -Xmx55000m
  2. CMS should reduce the amount of pauses, although it comes with overhead. The other settings for CMS seem to default automatically to the number of CPUs so they seem sane to me. The rest that I added are extras that might do good or bad generally for performance, and they should probably be tested.
  3. Definitely.
Edit
Report

1 Answer

3

Obviously heap size is not unlimited and the larger is the heap size, the more your JVM will eventually spend on GC. Though I think it is possible to set heap size quite high on 64-bit JVM, I still think it's not really practical. The advice here is better to have several JVMs running with the same parameters i.e. cluster of JBoss/Tomcat nodes running on the same physical machine and you will get better throughput.

EDIT: Also your GC behavior depends on the taxonomy of your heap. If you have a lot of short-living objects and each request to the server creates a lot of those, then your GC will collect a lot of garbage very often and thus on large heap size this will result in longer pauses. If you have very many long-living objects (e.g. caching most of your data in memory) and the amount of short-living objects is not that big, then having bigger heap size is OK.

answered 2009-11-08T11:09:35.050

Your Answer