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

Published on

ZGC vs G1GC tested on Minecraft servers in 2026. GC pauses, TPS, RAM use, and the best garbage collector for vanilla, Paper, and modded play.

Written by Jochem, Infrastructure Expert, 5-10 years experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

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

ZGC vs G1GC Minecraft server

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

MetricG1GC (Aikar's)ZGC
Average MSPT35ms33ms
GC pause (p99)50 to 100msUnder 1ms
TPS stabilityGoodExcellent
Memory overheadNormal+15%
CPU overheadNormal+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

Jochem

About the Author

Jochem, Infrastructure Expert, expert in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 5-10 years experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

I specialize in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters.

View my full bio and credentials →

Start Your MC Server Now Today

Join content creators worldwide who trust our Minecraft infrastructure. Setup is instant and support is always available. Start from €0.90/mo (Dirt) or €2.70/mo (Coal) and go live in minutes.