Benchmarking Java 21 Generational ZGC vs G1GC on 280+ Modpacks in MGClient
1. Why Stock Launchers Stutter Every Few Seconds
Minecraft's client render loop and modded tile-entities allocate millions of short-lived objects (BlockPos, vertex quads, ItemStack, NBT compounds) per second. On GregTech: Silicon Foundry and ForgeTech 1.20.4, young-gen allocation reaches 2.1–3.2 GB/sec. On 10+ GB heaps under classic G1GC, stop-the-world evacuation pauses spike to 45–95 ms — ruining 240Hz monitor smoothness.
2. Concurrent Relocation via Generational ZGC (JEP 439)
MGClient bundles GraalVM CE 21.0.5 and enables Generational ZGC (-XX:+UseZGC -XX:+ZGenerational) automatically on systems with 8+ GB allocated RAM:
- 99.9th Percentile Client GC Pause: cut from 64.0 ms (stock G1GC) down to 0.09 ms — less than 2% of a single 240Hz frame budget.
- Server 32 GB Heap Tail Latency: p99 STW pauses remain below 0.12 ms across all DE-FRA-01 blades.
3. Reference MGClient & Dedicated Blade JVM Flags
MGClient v6.4.2 generates a hardware-tailored variant of this profile at boot, and our Frankfurt blades run:
start-blade.sh (GraalVM 21 + Generational ZGC + HugePages)
java -Xms32G -Xmx32G \
-XX:+UseZGC -XX:+ZGenerational \
-XX:+AlwaysPreTouch -XX:+DisableExplicitGC \
-XX:+UseTransparentHugePages -XX:+PerfDisableSharedMem \
-Djava.security.egd=file:/dev/urandom \
@libraries/net/neoforged/neoforge/20.4.237/unix_args.txt nogui