Both Shenandoah and ZGC are low-pause garbage collectors designed to minimize the stop-the-world pauses that cause Minecraft server lag spikes. Here is how they compare.
Quick Comparison
| Feature | ZGC | Shenandoah |
|---|---|---|
| Developer | Oracle | Red Hat |
| Pause times | Sub-millisecond | Low millisecond |
| JDK availability | All major JDKs (17+) | OpenJDK, Red Hat builds |
| Heap support | Multi-terabyte | Multi-terabyte |
| CPU overhead | Moderate | Moderate |
| Memory overhead | ~15-20% extra | ~10-15% extra |
| Best for | Large heaps (10+ GB) | Medium to large heaps |
For Minecraft Servers
ZGC
ZGC's sub-millisecond pauses are ideal for Minecraft servers where even small lag spikes (50ms+) cause noticeable block lag and rubberbanding. ZGC performs garbage collection concurrently with the game thread, meaning TPS stays stable even during GC cycles.
-XX:+UseZGC
Shenandoah
Shenandoah also performs concurrent GC with low pauses. It uses slightly less memory overhead than ZGC but may have marginally higher pause times. Shenandoah is a good choice on Red Hat-based systems or when ZGC is not available.
-XX:+UseShenandoahGC
Which Should You Choose?
Use ZGC if:
- You allocate 8+ GB RAM to your server
- You run heavy modpacks (ATM10, Cobblemon)
- You use Java 21 (ZGC is mature in Java 21)
- You want the lowest possible pause times
Use Shenandoah if:
- ZGC is not available in your JDK distribution
- You want slightly lower memory overhead
- You run on Red Hat / CentOS / Fedora systems
Use G1GC (default) if:
- You allocate less than 8 GB RAM
- You use Aikar's flags (tuned for G1GC)
- You run a vanilla or lightly modded server
FAQ
Is ZGC better than Shenandoah for Minecraft? Slightly. ZGC has lower pause times. Both are much better than G1GC for large heaps.
Can I use Shenandoah with GraalVM? GraalVM ships ZGC. Shenandoah is available in standard OpenJDK builds.
Should I switch from Aikar's flags? Aikar's flags are tuned for G1GC. If you allocate 10+ GB RAM, ZGC or Shenandoah with different flags may perform better.
Related: ZGC vs G1GC for Minecraft, Best JVM arguments, GraalVM for Minecraft