JVM garbage collection using ZGC
The Z Garbage Collector (ZGC) is a low-latency garbage collector that is well-suited for large Java Virtual Machine (JVM) heaps.
ZGC is a single-generation, region-based, NUMA-aware, compacting collector, and like G1, works concurrently with the JVM application. ZGC does not track how many collection cycles objects in the heap have survived. Because each region of the heap is concurrently scanned in each cycle, objects are not sorted into "new" or "old" generations. This collector is suitable for applications with large amounts of memory that require short pause times because it does not pause the execution of application threads for more than 10 ms.
The recommended JVM properties when using ZGC for garbage collection are:
-XX:+UseZGC -XX:ConcGCThreads=10 -XX:InitiatingHeapOccupancyPercent=80 -XX:MaxNewSize=2g -XX:NewSize=2g
In the JVM startup arguments, you should configure the heap space with at least 15-20 GB of headroom space left for the system RAM. For example, for a server with 62 GB RAM, the xmx
and xms
arguments in the start-server.java-args
argument of the java.properties
file should be set to 45 GB, expressed by -Xmx45g -Xms45g
.