HOW TO - JVM Tuning for Content Server
By Raoul on Oct 06, 2008
Now I'm not a java developer (I'm actually not any kind of developer, and I'm especially not a java developer); but I have spent a lot of time tuning the JVM in various different server environments.
In fact, I'm on an architectural review engagement this week and JRE tuning is almost always a good place to start.
So why, oh why, is the documentation on this subject so hard to find and and so difficult to parse when you do find it? Is the assumption that only nerd-core java guys would ever want to set JAVA_OPTIONS? You'd think it would be easy to find a defnition of the correct syntax for setting environment variables to tune the JRE - you'd be wrong. (See this for an example)
Anyway, in the course of digging into this I did find some good info and in the spirit of sharing and kharma generation I'll pass it on.
Have you ever wondered why there's no hard and fast upper limit on the heap size for the JVM in windows? Well, it's because the JVM needs contiguous memory space for the heap and even windows systems with lots of RAM don't assign large blocks of RAM. The fuller / better explanation is here. I have found it very rare to be able to assign a heap larger than 1GB on windows, although some people have got the max up to 1.5GB. Either way, it can't be more than 75-80% of free RAM and these numbers are still <1/2 of what you can achieve on a Solaris system with enogh RAM.
FWIW, the syntax for setting this is JAVA_OPTIONS=-Xmx1024m -Xms1024m (I like to set the max and min to be the same to prevent fragmenation). You set this in intradoc.cfg, NOT in config.cfg.
There are also garbage collection options that can be very useful on Solaris and I can cover them in another post. I've never seen any benefit on a windows box from using them.
I'm also hearing great things from Chris Rothwell about using JRockit as a JVM rather than the Sun JVM provided with the install. I'll follow up on this more as I get a chance to explore it.