garbage-collectionjvmjstat

Definition of GCT (Total garbage collection time)


The "Total garbage collection time" can be determined by observing the GCT column printed by the command:

jstat -gc <pid>

as described by the documentation here: https://docs.oracle.com/en/java/javase/12/tools/jstat.html

It appears to be an amount of time spent doing GC since the Java process started, measured in seconds.

Is that per core? So, if a quad-core CPU was fully utilized by a single JVM instance for 100 seconds, and was garbage collecting 10% of the time, would GCT report 10 or 40? If I have hyperthreading enabled (i.e. 8 OS cores), then how should I reason about the GCT figure?

I'm using the OpenJDK12 HotSpot JVM.


Solution

  • GCT metric is collector specific. Each GC algorithm may define its own meaning for GCT.

    Usually it is the total wall clock time spent in the stop-the-world GC pauses. In particular, for G1, the default collector in OpenJDK 12, GCT is the sum of Full GC pauses + stop-the-world phases of concurrent GC cycles.

    However, for Shenandoah GC GCT also includes the concurrent GC time. In either case, GCT is measured with an absolute (wall clock) timer, irrespective of the number of threads or CPU cores.