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

Published on | Updated

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.

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. Set -Xms equal to -Xmx so the heap does not resize, and enable -XX:+ZGenerational on Java 21, since generational ZGC is far more efficient for Minecraft's short-lived allocations than the older non-generational mode.

What About Shenandoah?

Shenandoah, developed by Red Hat, is a third low-pause collector worth knowing about. It targets the same problem as ZGC, concurrent collection with minimal stop-the-world pauses, but with a slightly different tradeoff profile.

FeatureZGCShenandoah
DeveloperOracleRed Hat
Pause timesSub-millisecondLow millisecond
JDK availabilityAll major JDKs (17+)OpenJDK, Red Hat builds
Memory overhead10 to 20% extra10 to 15% extra, slightly leaner
Best forLarge heaps (10 GB+)Medium to large heaps

In practice, ZGC is the better default for a Minecraft server: it is available on every major JDK, has lower pause times, and is the collector most hosting panels and guides are tuned around. Reach for Shenandoah only if your JDK distribution does not ship ZGC, or you are already standardized on a Red Hat-based build. The flag is -XX:+UseShenandoahGC, and like ZGC, do not mix it with G1GC flags.

Measure, Do Not Guess

Whatever you pick, measure it. Run a profiler like Spark and watch your MSPT (milliseconds per tick) and GC pause graph under real load. If Aikar's flags already give you flat ticks, ZGC will not magically add TPS, GC tuning is only worth doing when GC is actually your bottleneck. For a deeper look at flag tuning beyond the collector choice itself, see Aikar's flags and JVM arguments.

No collector fixes weak hardware. GC tuning helps at the margins, fast single-thread CPU and enough RAM do the heavy lifting. A 16GB modpack on a slow shared core will stutter no matter which collector you choose. If you have already tuned flags and are still hunting for headroom, GraalVM is worth a look as a JIT-level alternative.

FAQ

Is ZGC better than Shenandoah for Minecraft? Slightly. ZGC has lower pause times and broader JDK availability. Both are a large step up from G1GC for heaps of 12GB or more.

Should I switch from Aikar's flags? Aikar's flags are tuned for G1GC and remain the best default under about 12GB. If you allocate 12GB or more, ZGC (or Shenandoah) with the flags above is worth testing.

Does GraalVM ship with ZGC? Yes, GraalVM ships ZGC. Shenandoah is available in standard OpenJDK builds instead.


Run your server without lag spikes. View Minecraft Hosting Plans


Legal Notice

Legal Notice & Disclaimer: This article constitutes an independent, factual comparative review and critical analysis for educational purposes only. Space-Node is not affiliated with, endorsed by, or sponsored by any hosting provider mentioned herein. All brand names, logos, and trademarks referenced are the registered intellectual property of their respective owners and are used solely for identification and factual reference.

Fair Use & Review Rights: This review is protected commentary, comparison, and criticism. It is based on publicly available information, official pages where available, published documentation, and general hosting engineering analysis. Where hands-on testing is not explicitly stated in the article, no private benchmark or internal infrastructure access is implied. This constitutes lawful comparative review and criticism protected under fair use doctrine.

Factual Accuracy: Specific plan claims are based on public information available at the time of writing. Specifications, pricing, and service features can change, so readers should verify current details on the provider's official website before purchasing. We make no false or defamatory statements; criticism is limited to documented facts, clearly labeled opinion, or general hosting guidance.

No Consumer Confusion: This article makes clear that Space-Node offers distinct, independently-developed hosting infrastructure. We explicitly differentiate our services, pricing, and technical specifications. No reader could reasonably be confused about service provider identity.

Right to Comparative Advertising: Space-Node reserves the right to publish factual comparative information about competing services. This is a recognized right in consumer protection law and advertising standards. Accurate comparative reviews cannot constitute trademark violation, defamation, or unfair competition.

Limitation of Liability: Space-Node makes no warranty regarding third-party services reviewed. Readers are responsible for verifying information independently before purchasing. Space-Node disclaims liability for third-party service changes, outages, or policy modifications.

Space-Node Services: For Space-Node's own managed hosting solutions, visit Minecraft hosting or VPS hosting.

Minecraft Ryzen 9 9950X / 7950X3D

Host Your Modded & Vanilla Minecraft Server

From €2.70/mo with ultra-fast NVMe storage, unmetered DDoS protection, and 1-click modpack installer (CurseForge, Modrinth & FTB ready).