Startup command
Heap size, jar name and the GC preset to tune for
java -Xms8G -Xmx8G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -jar server.jar --nogui start.sh (Linux/macOS)
Drop it next to the jar and chmod +x
#!/bin/bash java -Xms8G -Xmx8G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -jar server.jar --nogui
start.bat (Windows)
Double-click to launch the server
@echo off java -Xms8G -Xmx8G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -jar server.jar --nogui pause
What each flag does
One line per flag in the AIKAR preset
One-line explanations for every flag in the AIKAR preset. References: PaperMC — Aikar's flags · Oracle HotSpot GC Tuning.
-Xms8G
Initial heap size. Setting it equal to -Xmx avoids the JVM resizing the heap at runtime, which causes brief pauses.
-Xmx8G
Maximum heap size. The hard ceiling on Java heap memory. For Minecraft, set this to your total RAM minus 1-2 GB for the OS and overhead.
-XX:+UseG1GC
Selects the G1 (Garbage-First) collector. G1 splits the heap into regions and prioritizes those with the most garbage. Default since Java 9.
-XX:+ParallelRefProcEnabled
Processes weak/soft/phantom references in parallel during GC. Reduces pause times on heavy reference workloads (entities, chunks).
-XX:MaxGCPauseMillis=200
Soft target for max GC pause in ms. G1 tunes itself toward this. 200 ms is a safe ceiling for tick-bound servers.
-XX:+UnlockExperimentalVMOptions
Required to use experimental flags like G1NewSizePercent and G1MixedGCLiveThresholdPercent.
-XX:+DisableExplicitGC
Ignores System.gc() calls from plugins and mods. Prevents poorly-written code from triggering full-heap GC pauses.
-XX:+AlwaysPreTouch
Touches every page of the heap at startup so memory is committed up front. Slightly slower boot, far smoother first hour of runtime.
-XX:G1NewSizePercent=30
Minimum percentage of the heap reserved for the young generation. Raising it (Aikar uses 30-40%) gives short-lived chunks/entities room to die before promotion.
-XX:G1MaxNewSizePercent=40
Maximum young-generation size as a percentage of the heap. Pairs with G1NewSizePercent to size the eden+survivor regions for Minecraft's allocation rate.
-XX:G1HeapRegionSize=8M
Size of each G1 region. 8 MB suits typical heaps; 16 MB is recommended for ≥12 GB heaps to reduce region count.
-XX:G1ReservePercent=20
Reserve held back to avoid heap exhaustion during evacuation. Higher values trade headroom for fewer to-space failures.
-XX:G1HeapWastePercent=5
Tolerated waste percentage in old regions before mixed GC kicks in. Lower = more aggressive cleanup.
-XX:G1MixedGCCountTarget=4
Number of mixed GC cycles to amortize old-gen cleanup over. Smaller numbers = shorter individual pauses.
-XX:InitiatingHeapOccupancyPercent=15
Heap occupancy that triggers a concurrent marking cycle. Aikar lowers this aggressively to start GC before the heap fills.
-XX:G1MixedGCLiveThresholdPercent=90
Old-gen regions below this liveness ratio are eligible for mixed GC. Raising it lets G1 collect more regions per cycle.
-XX:G1RSetUpdatingPauseTimePercent=5
Cap on the percentage of GC pause spent updating the remembered set. Caps a known G1 pause-spike source.
-XX:SurvivorRatio=32
Ratio of eden to a single survivor space. 32 means each survivor is 1/32 of eden — small survivors push short-lived objects out of young gen faster.
-XX:+PerfDisableSharedMem
Disables JVM perf counter shared memory file. Avoids /tmp I/O stalls that can spike pauses on busy hosts.
-XX:MaxTenuringThreshold=1
Promotes objects from young to old gen after surviving 1 GC. Aikar's setting — Minecraft objects are mostly chunk-lifetime, so promote fast.
Which preset?
Aikar, vanilla G1GC or ZGC — and how much heap to give it
Aikar's flags are battle-tested on Paper and Spigot. They tune G1GC for low pause times and predictable allocation. Use these unless you have a specific reason not to.
Vanilla G1GC is the safe minimal config — it works everywhere (Mojang, Forge, NeoForge, Fabric) with no assumptions about garbage patterns.
ZGC + Generational (Java 21+) gives sub-millisecond pauses but uses roughly 10% more memory. Try it if your server has heavy entity loads (raid farms, mass mob farms) and 16 GB or more of RAM.
Don't allocate more than about 50–60% of physical RAM to the JVM — the OS needs the rest for chunk caching and system services.
More server tools
The rest of the set, for the parts of the server this one doesn't touch
Frequently asked questions
Heap sizing, GC choice and what Aikar's flags actually do
What are Aikar's flags? +
Aikar's flags are a hand-tuned set of JVM arguments published by PaperMC contributor Daniel Ennis (Aikar) that configure G1GC for the way Minecraft allocates memory. They aggressively size the young generation, lower the GC trigger threshold, and disable known pause-spike sources so chunks, entities, and ticks don't stall. They are the standard starting point for any Paper, Purpur, or Spigot server.
Are Aikar's flags still relevant in 2026? +
Yes — for Java 17/21 servers running Paper or its forks, Aikar's flags remain the most battle-tested G1 configuration. The defaults haven't materially changed since 2020 because Minecraft's allocation pattern hasn't either. ZGC is a newer option for high-RAM hosts on Java 21+, but G1 with Aikar's tuning still wins on smaller heaps (≤8 GB) and on single-core hosts.
What's the difference between G1GC and ZGC? +
G1GC (Garbage-First) splits the heap into regions and runs short, parallel pauses to evacuate the regions with the most garbage — pause times typically 50-200 ms. ZGC (Z Garbage Collector) does almost all of its work concurrently with the application, holding pauses under 1 ms even on 16+ GB heaps. ZGC trades a bit of throughput for predictable latency and benefits from generational mode in Java 21+.
How much RAM does my Minecraft server need? +
A vanilla SMP for ≤10 players runs comfortably on 4 GB. A Paper server with a few plugins and 20 players wants 6-8 GB. Modded servers (Forge/Fabric with 100+ mods) usually start at 8 GB and climb with mod count. Always leave 1-2 GB free for the OS, plugins' off-heap allocations, and chunk I/O — never give the JVM 100% of system RAM.
Last verified for Minecraft 26.2