New Book: Pro Java EE 5 Performance Management and Optimization
Ok, here we go, nobody is interested in the garbage collection, who, for the Pointer sake, needs that GC?
That is the question.
That was pretty much my mode and mood when I started a new book of Steven Haines “Pro Java EE 5 Performance Management and Optimization”.
And reality p u n c h e d ! me right in my face dear buddies…
It occurred, that default GC parameters are never, almost never set up right and optimal in enterprise large boxes! It is also occurred, that 80% gain in performance may be reached by tuning of 3 simple VM start parameters. But what punched me more than anything else is a complete (you have no idea, HOW COMPLETE) difference between SUN VM and IBM VM (you may be not aware yet, but Websphere is kinda on square wheels…).
More concrete : IBM VM is not "generations" based, like Sun's one. It's different entirely.
So here are several practical tips for starter, for the rest of things, please address the book:<OL TYPE=A>
It is nice to monitor your GC from time to time, the VM
argument for that is: -verbose:gc
There are a lot of additional parameters that allow you set up a log with different levels of severity. This log is very helpful!!!
Once you have “Full GC” time very long in your logs, you should be alerted, during that period system literally sucks: nothing is moving. Start your tuning there.
The close to best parameters of SUN VM . (this may vary and
depend on concrete case, but in general) (Suppose you have the
ability with your concrete hardware architecture and OS to provide
1024 Mb for the java process – that is the Windows on 32 bit
Your almost optimal GC parameters are:
-Xmx1024m –Xms1024M –XX:MaxNewSize=448m –XX:NewSize=448m –XX:SurvivorRatio=6.
Why? Details are in the book, but in general you better initialize your entire heap from the beginning and make an Eden/SurvivorSpace ratio==8, that is why SurvivorRatio=6! Why 6??!!! For the pointer sake, I just said 8! Because Survivor space in GC has actually 2 sub spaces. 2+6 makes it. :) Do not mind a little mathematical gap :)
Last thing: Eden size must be less than half of Xmx!( 448m thing)
You yet not terrified enough? OK, here it comes:
IBM VM will crash very frequently with such perfect and “optimal configuration”!!!
IBM should never be with equal Xmx and
Xms! Otherwise it will start GC only when maximum heap is reached.
That is what most CEOs see in their very bad dreams!
Xms should be estimated like a space that application occupies, when started (Not yet work on full speed).
On IBM you have no choice but have good maximum heap. If your
system most of the time on more than 70% of full memory capacity,
you have to increase maximum. Practical advice: buy a 64bit monster
and install a Penguin. Some finer tuning may bring you to ideal 70%
load all the time.
Now to real life:
It helps! Really! I had an experiment in my Websphere overloaded and it gave me like 20% gain in CPU time. I assume it is because of GC improved, at least I had not changed anything else.</OL>