g1gc logs - Ergonomics -how to print and how to understand
By Yu Zhang-Oracle on Aug 07, 2014
Ever wondered how g1 decide which regions should be included in the collection set, when to trigger the concurrent marking cycle, or why stops mixed gc? You can get that information from -XX:+PrintAdaptiveSizePolicy
In addition to the basic parameters -XX:+PrintGCTimeStamps -XX:+PrintGCDetails mentioned in previous blog how to print and how to understand - basic, add -XX:+PrintAdaptiveSizePolicy
The output from basic gc details is skipped here. Please refer to blog how to print and how to understand - basic.
Here I posted the Ergonomic output for a young gc. At the end of this gc, g1 requests the concurrent marking cycle.
The 1st line prints out the number of cards to be processed: 42639, predicted time to process those cards: 20.23 ms, since target pause time is 100.00ms, there is 79.77ms left
The 2nd line shows the number of regions in the young gen added to the collection set: eden: 140 regions, survivors: 20 regions, old: 0 regions, predicted pause time: 826.18 ms, target pause time: 100.00 ms
The 4th line shows g1 tries to expand the heap, since gc overhead(45.64 %) is over the threshold(10.00%)
The 5th line shows that the concurrent marking cycle is requested, since the heap occupancy (48586817536 bytes) is higher than the threshold 45% of the total heap (48318382080 bytes)
After the marking cycles are done, sometimes, young gc has a line like this:
This indicates mixed gcs will be started, as the reclaimable heap 13.29% is higher than the threshold 10%
Mixed gc has additional information about how old regions are included in the CSet
The 3rd line shows g1 can not add more old regions to CSet since the predicted time is already over the target pause time. However, g1 is requested to add minimum old regions (63) to CSet.
The 4th line shows that g1 added 63 old regions to meet the minimum requirement.
The last line indicates the next gc is mixed gc as well, since the reclaimable heap after this gc is 11.47%, higher then the threshold 10%.
Thresholds and Parameters:
We mentioned a lot of thresholds. Here we will explain what those thresholds are and how to control them. The numbers in <> is the default value.
- -XX:G1NewSizePercent=<5> -XX:G1MaxNewSizePercent=<60>
- -XX:G1MixedGCCountTarget=<8> -XX:+UnlockExperimentalVMOptions -XX:G1OldCSetRegionThresholdPercent=<10>
- -XX:+UnlockExperimentalVMOptions -XX:G1MixedGCLiveThresholdPercent=<65>
The total number of candicate regions devided by the G1MixedGCCountTarget is the minimum old regions added to CSet.
Some times we see message like "old CSet region num reached max". G1OldCSetRegionThresholdPercent defines the percentage of the heap as the maximum number of old regions can be added to CSet.