Java Reference
In-Depth Information
quently for G1 should be avoided. Check the size of the heap after a concurrent cycle, and
make sure that the InitiatingHeapOccupancyPercent value is set higher than that.
Tuning G1 mixed GC cycles
After a concurrent cycle, G1 cannot begin a new concurrent cycle until all previously marked
regions in the old generation have been collected. So another way to make G1 start a mark-
ing cycle earlier is to process more regions in a mixed GC cycle (so that there will end up be-
ing fewer mixed GC cycles).
The amount of work a mixed GC does is dependent on three factors. The first is how many
regions were found to be mostly garbage in the first place. There is no way to directly affect
that: a region is declared eligible for collection during a mixed GC if it is 35% garbage. (It is
likely this value will become a tunable parameter at some point; the experimental name for
the parameter (available in experiment builds of the open source code) is -
XX:G1MixedGCLiveThresholdPercent= N .)
The second factor is the maximum number of mixed GC cycles over which G1 will process
those regions, which is specified by the value of the flag -XX:G1MixedGCCountTarget= N .
The default value for that is 8; reducing that value can help overcome promotion failures (at
the expense of longer pause times during the mixed GC cycle).
On the other hand, if mixed GC pause times are too long, that value can be increased so that
less work is done during the mixed GC. Just be sure that increasing that number does not
delay the next G1 concurrent cycle too long, or a concurrent mode failure may result.
Finally, the third factor is the maximum desired length of a GC pause (i.e., the value speci-
fied by MaxGCPauseMillis ). The number of mixed cycles specified by the G1MixedGCCoun-
tTarget flag is an upper bound; if time is available within the pause target, G1 will collect
more than one-eighth (or whatever value has been specified) of the marked old generation re-
gions. Increasing the value of the MaxGCPauseMillis flag allows more old generation re-
gions to be collected during each mixed GC, which in turn can allow G1 to begin the concur-
rent cycle sooner.
Search WWH ::

Custom Search