Java Reference
In-Depth Information
Are you getting the performance you need with the default settings?
Try the default settings first. As GC technology matures, the ergonomic (automatic) tun-
ing gets better all the time.
If you're not getting the performance you need, make sure that GC is your problem. Look
at the GC logs and see how much time you're spending in GC and how frequently the
long pauses occur. For a busy application, if you're spending 3% or less time in GC,
you're not going to get a lot out of tuning (though you can always try and reduce outliers
if that is your goal).
Are the pause times that you have somewhat close to your goal?
If they are, then adjusting the maximum pause time may be all you need. If they aren't,
then you need to do something else. If the pause times are too large but your throughput
is OK, you can reduce the size of the young generation (and for full GC pauses, the old
generation); you'll get more, but shorter, pauses.
Is throughput lagging even though GC pause times are short?
You need to increase the size of the heap (or at least the young generation).
More isn't always better: bigger heaps lead to longer pause times. Even with a concurrent
collector, a bigger heap means a bigger young generation by default, so you'll see longer
pause times for young collections. But if you can, increase the heap size, or at least the
relative sizes of the generations.
Are you using a concurrent collector and seeing full GCs due to concurrent-mode fail-
If you have available CPU, try increasing the number of concurrent GC threads or start-
ing the background sweep sooner by adjusting the InitiatingHeapOccupancyPercent .
For G1, the concurrent cycle won't start if there are pending mixed GCs; try reducing the
mixed GC count target.
Are you using a concurrent collector and seeing full GCs due to promotion failures?
In CMS, a promotion failure indicates that the heap is fragmented. There is little to do
about that; using a larger heap and/or performing the background sweep sooner can help
in some cases. It may be better to try G1 instead. In G1, an evacuation failure (to-space
overflow) indicates essentially the same thing, but the fragmentation can be solved if G1
performs its background sweeping sooner and mixed GCs faster. Try increasing the num-
Search WWH ::

Custom Search