Java GC Tutorials - Herong's Tutorial Examples - v1.12, by Herong Yang
Collector Combinations: Serial, Parallel, Concurrent, G1, Z
This section describes different garbage collector combinations supported by JVM 12 HotSpot: Serial, Parallel, Concurrent, G1 and Z
In previous sections, we discussed garbage collectors for Young generation and Tenured generation independently:
A single generation collector, called Z (or ZGC) The Z collector has been introduced since JVM 11 and it is still available only on Linux operating systems as an experimental option. The Z (or ZGC) Collector can be invoked by the "-XX:+UseZGC" option.
Now let's look dependencies and compatibilities of garbage collectors. As of JVM 17, HotSpot JVM can support the following 5 combinations of garbage collectors:
GC Combination Minor GC Major GC Thread -------------- -------- ------- ------ Serial Serial Serial 1 -XX:+UseSerialGC Stop-the-world Stop-the-world Parallel Parallel Scavenge Parallel Old -XX:+UseParallelGC Mostly Parallel Mostly Parallel Multi -XX:+UseParallelOldGC Stop-the-world Stop-the-world Concurrent Parallel New CMS -XX:+UseConcMarkSweepGC Mostly Parallel Mostly Parallel Multi Stop-the-world Mostly concurrent Concurrent Old only Serial CMS -XX:+UseConcMarkSweepGC Mostly Parallel Mostly Parallel Multi -XX:-UseParNewGC Stop-the-world Mostly concurrent Garbage First (G1) Garbage First Garbage First Multi -XX:+UseG1GC Mostly Parallel Mostly Parallel Stop-the-world Mostly concurrent Z - 1 Generation Z Multi -XX:+UseZGC Mostly Parallel Mostly concurrent
Note that:
Next, we will discuss each GC combination individually.
Table of Contents
Heap Memory Area and Size Control
JVM Garbage Collection Logging
►Introduction of Garbage Collectors
JVM Memory Manager - Garbage Collector
Generational Garbage Collection in HotSpot
Young Generation Collection - Minor GC
Young Generation Collectors - Serial, PS, ParNew, G1
Tenured Generation Collection - Major GC
Tenured Generation Collectors - Serial, ParOldGen, CMS, G1
►Collector Combinations: Serial, Parallel, Concurrent, G1, Z
Serial Collector - "+XX:+UseSerialGC"
Parallel Collector - "+XX:+UseParallelGC"
Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"
Garbage First (G1) Collector - "+XX:+UseG1GC"
The Z Garbage Collector (ZGC) - "+XX:+UseZGC"
Object References and Garbage Collection
Garbage Collection Performance Test Program
Performance Tests on Serial Collector
Performance Tests on Parallel collector
Performance Tests on Concurrent collector
Performance Tests on G1 collector