Java Reference
In-Depth Information
to start, though CMS will adjust that value in order to try and keep pace with the amount of
data promoted to the old generation). If that isn't long enough, concurrent mode failures (and
full GCs) will occur; the goal here is to tune incremental CMS to avoid (or at least minimize)
those GCs.
Start by increasing the CMSIncrementalSafetyFactor , which is the percent of time added
to the default duty cycle. The default duty cycle value starts at 10%, and the safety factor is,
by default, an additional 10% (yielding the default 20% initial duty cycle). To give the back-
ground thread more time to run, try increasing the safety factor (up to a maximum of
90—which will cause the incremental cycle to run 100% of the time).
Alternately, adjust the duty cycle directly by setting the CMSIncrementalDutyCycleMin
value to a number greater than its default value (10). However, this value is subject to auto-
matic adjustment by the JVM as it monitors the amount of data promoted to the old genera-
tion. So even if that number is increased, the JVM may decide on its own that the increment-
al CMS doesn't need to run that often, and hence it may decrease that value. If an application
has bursts in its operation, that calculation will frequently be incorrect, and you will need to
both set the duty cycle explicitly and disable the adjustment of that value by turning off the
CMSIncrementalDutyCycle flag (which is true by default).
QUICK SUMMARY
1. Incremental CMS is useful when an application needs low pause times but is run-
ning on a machine with limited CPU resources.
2. Incremental CMS is controlled via a duty cycle; lengthening the duty cycle can
help to prevent concurrent mode failures with CMS.
Understanding the G1 Collector
G1 is a concurrent collector that operates on discrete regions within the heap. Each region
(there are by default around 2,048 of them) can belong to either the old or new generation,
and the generational regions need not be contiguous. The idea behind having regions in the
old generation is that when the concurrent background threads look for unreferenced objects,
some regions will contain more garbage than other regions. The actual collection of a region
still requires that application threads be stopped, but G1 can focus on the regions that are
Search WWH ::




Custom Search