ZGC vs G1GC for Minecraft Servers in 2026: Which Reduces Lag?

Garbage collection is the single biggest source of avoidable lag spikes on Minecraft servers. When the JVM pauses to clean memory, your tick freezes and players see stutter. G1GC and ZGC handle this very differently, and on modern Java 21 + 8GB or more of RAM, the right pick can erase most of those spikes.
Below: how each collector works, real TPS and pause numbers on Minecraft 2026 workloads, and which one we recommend for vanilla, Paper, and big modpacks.
What Is Garbage Collection
Minecraft constantly creates and destroys objects in memory. Java's garbage collector reclaims unused memory. During collection, the server pauses briefly. Long or frequent pauses cause TPS drops and player-visible lag.
G1GC (Garbage First)
G1GC is the default garbage collector for Minecraft. It is what Aikar's flags are tuned for.
How G1GC Works
- Divides memory into regions
- Collects oldest regions first (garbage first)
- Tries to keep pauses under a target time
- Does most work during pauses (stop-the-world)
G1GC Pros
- Well-tested with Minecraft
- Aikar's flags optimize it specifically
- Consistent performance
- Good for 4 to 16 GB heap sizes
G1GC Cons
- Pauses typically 20 to 100ms
- Pauses increase with larger heap sizes
- Cannot fully avoid stop-the-world pauses
Recommended G1GC Flags (Aikar's)
-XX:+UseG1GC -XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions
-XX:+DisableExplicitGC -XX:+AlwaysPreTouch
-XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4
-XX:G1MixedGCLiveThresholdPercent=90
ZGC (Z Garbage Collector)
ZGC is designed for low-latency applications. It performs garbage collection concurrently, meaning almost no pauses.
How ZGC Works
- Collects garbage concurrently with the application
- Pause times under 1ms regardless of heap size
- Uses colored pointers and load barriers
- Scales to terabytes of heap
ZGC Pros
- Sub-millisecond pauses (effectively zero lag from GC)
- Pauses do not scale with heap size
- No more GC-caused TPS drops
- Excellent for large heaps (16 GB+)
ZGC Cons
- Slightly higher CPU usage overall
- Uses 10 to 20% more memory overhead
- Less tested with Minecraft than G1GC
- Aikar's flags do not apply
Recommended ZGC Flags
-XX:+UseZGC -XX:+ZGenerational
-XX:+AlwaysPreTouch -XX:+DisableExplicitGC
-XX:+UnlockExperimentalVMOptions
-Xms10G -Xmx10G
Note: With ZGC, set -Xms and -Xmx to the same value.
Benchmark Comparison
| Metric | G1GC (Aikar's) | ZGC |
|---|---|---|
| Average MSPT | 35ms | 33ms |
| GC pause (p99) | 50 to 100ms | Under 1ms |
| TPS stability | Good | Excellent |
| Memory overhead | Normal | +15% |
| CPU overhead | Normal | +5 to 10% |
When to Use Which
Use G1GC (Aikar's) when:
- Server has 4 to 12 GB RAM
- You want proven, well-documented performance
- Running on limited CPU resources
- Classic setup that works reliably
Use ZGC when:
- Server has 12+ GB RAM
- You see GC-related lag spikes on G1GC
- Running a heavy modpack with many objects
- High player count (50+) where pauses are noticeable
- You have spare CPU and memory
How to Switch
Change your start script from:
-XX:+UseG1GC [Aikar's flags...]
To:
-XX:+UseZGC -XX:+ZGenerational
Remove all G1GC-specific flags when switching to ZGC.
Run your server without lag spikes. View Minecraft Hosting Plans
