Comment 10 for bug 541520

Revision history for this message
Gabriel Nell (gabriel-nell) wrote :

Folks -- sorry for chiming in here after the train has apparently left the station :)

I've been working on optimizing my Tomcat configuration for the past couple days, and this optimization has mostly centered around the garbage collector. I'm concerned that specifying the CMS collector is classic premature optimization. If I absorbed this change, my application performance would have gotten suddenly worse. But let's not talk about my specific case.

To excerpt from the same whitepaper referenced above (section 6, first paragraph):

"Thus, the initial recommendation for selecting and configuring a garbage collector is to do nothing! That is, do not specify usage of a particular garbage collector, etc. Let the system make automatic choices based on the platform and operating system on which your application is running."

As this implies, the Hotspot JVM will actually select a collector for you based on the system resources. Further, Sun's GC tuning document found at

http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#available_collectors.selecting

Advises that heap size should actually be the first knob you adjust before switching collectors.

I'm all for choosing smart defaults. But I think in this case the advice from the guys who make Java is pretty clear. Let the JVM decide, and if it's not good enough, only then optimize for the metrics you care about, and do not begin by choosing a specific collector.