-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Archive Region Calculation (#211) #369
Improve Archive Region Calculation (#211) #369
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcpeppe and I had some discussion about this. We want to verify whether archive regions are counted as old gen regions which may mean that these regions are being accounted for twice. |
Hi, just checked with the parse rules: gctoolkit/parser/src/main/java/com/microsoft/gctoolkit/parser/unified/UnifiedG1GCPatterns.java Line 47 in 00ff2f8
And the way of how the tool kit processes the log: gctoolkit/parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java Lines 481 to 502 in 00ff2f8
it seems it will differentitate the type of the region, and set the region summary accordingly |
@kkdlau - I found "OpenArchive" and "CloseArchive" as region types in jdk-11 and jdk-17. But I don't see an archive region type in jdk-8 or jdk-21. The only evidence I see of "Archive" appearing in a log trace is in the remembered set stats, but only in jdk-17. Do you have a log file with the pattern "Archive regions:"? |
@dsgrieve one of examples I found from
But it is quite surprising to know that the way JDK handles the archive region is changing over generations. I will also look at OpenJDK's G1CollectedHeap implementation to understand more about the issue. |
@dsgrieve I just walked through OpenJDK and found that Archive Regions are only available in JDK 14 and 17. JDK 14: https://github.com/openjdk/jdk/blob/ae39310243b0486f5a6f1049c6ec5f29db31170c/src/hotspot/share/gc/g1/g1HeapTransition.cpp#L174-L177 log_info(gc, heap)("Archive regions: " SIZE_FORMAT "->" SIZE_FORMAT,
_before._archive_length, after._archive_length);
log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
usage._archive_used / K, ((after._archive_length * HeapRegion::GrainBytes) - usage._archive_used) / K); JDK 8 doesn't have Archive Region type: typedef enum {
Unset,
Eden,
Survivor,
Old,
SingleHumongous,
StartsHumongous,
ContinuesHumongous
} RegionType; When I look at how the JVM collects region info, archive regions are not counted as old regions: if (r->is_old()) {
_usage._old_used += r->used();
_usage._old_region_count++;
} else if (r->is_archive()) {
_usage._archive_used += r->used();
_usage._archive_region_count++; I think, even though archive regions are only available in JDK 14 and 17, we can still subtract the size of archive regions from the total. Since the size of archive regions is 0 in other versions, and there is no double counting for old regions and archive regions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, GCToolkit recognized archive regions but did not use this data in its calculations. This change improves the accuracy of tenured generation metrics for G1GCPause events.