views:

98

answers:

3

Possible Duplicate:
Has anyone found Garbage Collection tuning to be useful?

Does it really help? Isn't the jvm written by much smarter people? What will be case to tune it manually?

+2  A: 

Until dynamically ergonomic systems and instrumentation APIs exist (hello IBM & Oracle? you know my email, let's talk), the JVM is still limited as a machine to a set amount of size at startup. A 64 mebibyte heap won't work for a large JBoss application, and there's no reason to have an 8 gibibyte heap for a calculation.

Additionally, JVMs offer a few different GC schemes as to not have one-size-fits-all.

I tune all of my operational JVMs by analyzing the GC logs. You tune your Linux kernels yes?

Xepoch
I fail to see how the initial size of the heap is a problem — any heap is large enough at startup when live data is zero, and if the GC can resize the heap as live data grows, it can resize it just after start-up. I do not tune my kernel, it would be too hard to ever amortize the time spent on such a risky endeavor with the milliseconds gained (in the best of cases). And I do not send e-mail to large faceless companies, much less expect any reaction from them if I did.
Pascal Cuoq
@Pascal, the IBM comment is a joke, hope you're doing the same. I said nothing about initial size, but I think you'd agree that over 80% of Java deployments at minimum set `-Xmx`. So you don't ever set anything via `sysctl` or set parms in `/proc`?
Xepoch
+2  A: 

The JVM is well writen, but no universall GC policy exists for every situation. Check this:

http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

Raul Lapeira Herrero
+2  A: 

Tuning garbage collection will help your application performance when garbage collection is the bottle neck for your application. You can use the JVM command line argument -verbose:gc to help diagnose the issue.

For most applications, I would say that out of the box garbage collection should be sufficient. If you are having performance problems I would reevaluate your code.

Adam Burk