newrelic/newrelic-jfr-core

Add BasicGarbageCollectionSummarizer to JFRD

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.

Want access to detailed GC metrics for resource utilization analysis.

Feature Description

Want access to these metrics:

  • GC Major Collection Count
  • GC Minor Collection Count
  • GC Major Collection Time
  • GC Minor Collection Time
  • GC ParNew Time. Minor Collection Time is the same as ParNew.

A lot of these details came out of this slack conversation with Ben

JFR produces the jdk.GarbageCollection GC event

jdk.GarbageCollection {
  startTime = 11:52:18.076
  duration = 0.502 ms
  gcId = 859
  name = "G1New"
  cause = "G1 Evacuation Pause"
  sumOfPauses = 0.502 ms
  longestPause = 0.502 ms
}

To capture these vents, create a new BasicGarbageCollectionSummarizer in JFRD to accept these events and summarize into Summary metrics. The EVENT_NAME of the summarizer will be jdk.GarbageCollection

There will be 4 new metrics created from this summarizer.

jfr.GarbageCollection.minorCount
jfr.GarbageCollection.minorDuration
jfr.GarbageCollection.majorCount
jfr.GarbageCollection.majorDuration

The name field of the event specifies which Garbage Collector this data is for (i.e. G1, CMS, Parallel) and if it is Major (old) or Minor(young) event. "G1New" here means a young event. When multiple garbage collectors are in use, for example when Parallel (name = ParNew) and G1 (name = G1New), both events will feed into one metric - jfr.GarbageCollection.minorCount

The name field is important as it will determine if JFRD supports including the event in the summary metric.

First

Test JFR with all 3 mainstream collectors - Parallel, CMS, G1 - to generate and examine the raw JFR events. Need to see the structure of the data, especially the name value. Verify the name for Old and Young events for all three collectors.

Second

Add the new summarizer to JFRD and manually test for all three different collector scenarios.

Priority

Must Have

GC implementations:

  • Serial Garbage Collector: -XX:+UseSerialGC
  • Parallel Garbage Collector: -XX:+UseParallelGC
  • CMS Garbage Collector: -XX:+UseParNewGC / -XX:+UseConcMarkSweepGC
  • G1 Garbage Collector: -XX:+UseG1GC

https://www.baeldung.com/jvm-garbage-collectors

Here's a list of all of the GC Names and which major version of Java they were added in.

JDK 12

Shenandoah

JDK 11

Z
N/A

JDK 10

G1Full

JDK 8

ParallelOld
SerialOld
PSMarkSweep
ParallelScavenge
DefNew
ParNew
G1New
ConcurrentMarkSweep
G1Old
GCNameEndSentinel

Nice find!

We'll proceed with the following breakdown and log on ignored.

jfr.GarbageCollection.minorDuration

DefNew
ParNew
G1New
PSMarkSweep
ParallelScavenge

jfr.GarbageCollection.majorDuration

ParallelOld
SerialOld
G1Old
ConcurrentMarkSweep
G1Full

Ignored

N/A
GCNameEndSentinel
Shenandoah
Z