1

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?

Community
  • 1
  • 1
javaguy
  • 4,404
  • 10
  • 32
  • 35
  • If you are seeing your application spend a lot of time in garbage collection (say over 5%), then you could possibly gain some performance. Also, if an application is very garbage collection time sensitive, you need to be very careful when your pauses happen. – bwawok Oct 13 '10 at 01:44

3 Answers3

3

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

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

  • Thank you for the edit on my other post, but it was rejected by other reviewers before I saw it. I can see that it could be a helpful addition because it shows where the header tank might be (the design does keep changing so we can't always be sure) but since your comment was only "Comment: Added video link" people thought you may be trying to answer somehow. Editing other people's posts is great (when helpful) but it's necessary to explain more clearly why it is helpful to the post and does not conflict with the author's intent so that it doesn't get rejected in review. I overrode the reject. – uhoh Oct 26 '20 at 23:16
  • You added an explanation for the video above it and that's great! But your reason for the edit should mirror that as well; "Comment: Added video link *in order to show the tank location and the way it is depleted" Anyway, thanks again! – uhoh Oct 26 '20 at 23:19
  • Since visualizing the tank's location and how it offsets mass near the bottom to keep the center of mass above the center of pressure, it might have been better used either in the existing answer, or as a new "supplementary answer". – uhoh Oct 26 '20 at 23:29
2

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?

Jé Queue
  • 10,359
  • 13
  • 53
  • 61
  • 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 Oct 12 '10 at 22:43
  • @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`? – Jé Queue Oct 13 '10 at 01:31
2

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
  • 44
  • 2