Jon Masamitsu's Weblog

  • Java
    January 2, 2006

Since It's Not Magic

Guest Author

So by now you've tried GC ergonomics and things are working pretty well. If you didn't have
any GC related command line flags, your reactions could run the gamut from
the "big yawn" to an eye-popping "that's cool". The "big yawn" means that GC probably
doesn't matter for your application. The "that's cool" means that GC matters but nobody
ever told you. If you did have a bunch of GC related command line flags and you threw them out
in order to try GC ergonomics, then 80% of you are happy and just glad to forget those
command line flags. But 20% of you are thinking "Hmmm, not quite as good". So what else
do you need to know about GC ergonomics? By the way I invoke the 80/20 rules quite
often, especially when I have no idea what the real numbers are.

By default ergonomics gives you a larger maximum heap size. "Larger" is relative to the default
maximum heap size you got prior to ergonomics in 5.0. This larger maximum heap size depends on the
amount of physical memory on the system (the more physical memory you have, the larger
the maximum heap size you get), but it is capped at 1G. If you had a command line flag
that sets a larger maximum heap size, put it back. Ergonomics just doesn't know
you're in the 20% that needs a larger heap. If you set a larger maximum heap size,
ergonomics will still grow and shrink the generations for better performance but
now will have more space to play with. By the way if you set a smaller maximum heap
size, ergonomics still does its stuff but just within a smaller heap.

Ergomonics has a default for the relative sizes of the young generation and
the tenured
generation in the heap. If you have command line flags to specify the sizes of the
generations (probably something like -XX:NewRatio=ratio or -XX:MaxNewSize=bytes),
use them. GC ergonomics normally does not change the maximum size of a
generation so if you know something about how your application runs such that
you know it benefits from a larger or smaller young generation, pass that
information along on the command line. Again GC ergonomics just works within
the limits of the heap it's given.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.