RFR: JMC-5596: Rule to detect if there has been a Full GC with G1 or CMS

Andrew Azores aazores at redhat.com
Mon Dec 10 21:36:19 UTC 2018


Here is a patch addressing JMC-5596 [0]. A new JFR rule is added which 
detects Full GC occurrences when either the G1 or CMS collectors are in 
use. The implementation for detecting these events is based on my own 
reading through and testing of JDK (11) sources, as well as discussions 
on the hotspot-jfr-dev list [1].

For G1 the collections are detected by filtering for 
jdk.GarbageCollection events where the gcName field is set to "G1Full", 
since the G1 sources do in fact have separate tracers to identify New, 
Old, and Full collections by G1. Furthermore, manual testing shows 
perfect agreement between the G1Full event count and the "Pause Full" 
log message (-XX:+PrintGCDetails) count.

For CMS the picture is a little more hazy, but the 
jdk.OldGarbageCollection event is used, since this appears to be emitted 
in the expected situations and was mentioned in the hotspot-jfr-dev 
discussion. Unfortunately, CMS does not have separate tracers like G1, 
so the jdk.GarbageCollection events seemingly cannot be filtered by the 
type of collection that they represent. In my testing there are 
sometimes discrepancies between the number of OldGarbageCollection 
events emitted and the number of "Pause Full" messages, but I have never 
seen a situation where there was 0 of one and >0 of the other (ie. a 
false positive or false negative result). I suspect there is a pathway 
that leads to >1 OldGarbageCollection event being emitted for only one 
log message.

Additionally, I have refactored the CollectorType enum, which is used by 
this new FullGcRule as well as the existing GcStallRule. I've updated 
the enum members so that it is inline with the GcName enum within the 
JDK itself, and cleaned up the implemenation of getOldCollectorType 

[0] https://bugs.openjdk.java.net/browse/JMC-5596


Andrew Azores
Software Engineer, OpenJDK Team
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fullgcrule-01.patch
Type: text/x-patch
Size: 16331 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/jmc-dev/attachments/20181210/6bdaf6c3/fullgcrule-01.patch>

More information about the jmc-dev mailing list