Aikar's JVM Flags for Minecraft Servers Explained
What Aikar's flags are, why they improve Minecraft server performance, and how to apply them via the panel Startup tab.
Aikar's flags are a community-maintained set of JVM (Java Virtual Machine) arguments that optimize garbage collection for Minecraft servers. They're considered the gold standard for server performance and reduce TPS lag spikes by 50–80% on most setups.
What They Do
| Optimization | Effect |
|---|---|
| Switch to G1GC | Replaces Java's default garbage collector with one designed for low-pause workloads |
| Reduce GC pause times | Eliminates the periodic stutters caused by full garbage collection |
| Optimize allocation | Tunes new-generation sizing for Minecraft's allocation patterns |
| Pre-touch memory | Allocates and touches all memory at startup so the OS doesn't reclaim it |
| Disable explicit GC | Prevents poorly-written plugins from triggering full GCs manually |
Apply Aikar's Flags
Open Startup
In the XGamingServer Panel, click Startup in the sidebar.
Find the JVM Flags field
Look for JVM Flags, Additional Java Arguments, or Java Options — the exact label varies. This is where startup JVM arguments go.
Paste the flags
Copy the appropriate flag set below (depending on your RAM allocation) and paste it into the field.
Restart the server
Restart from Console. The new flags take effect immediately.
The Flags
For Servers with 12 GB RAM or Less
-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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=trueFor Servers with More Than 12 GB RAM
Use the same flags but change these two values:
-XX:G1NewSizePercent=40
-XX:G1MaxNewSizePercent=50This is because larger heaps benefit from a bigger young generation.
Verify the Flags Are Active
In the Console, look for the startup log. With Aikar's flags applied, you should see:
[main/INFO] Starting net.minecraft.server.Main
[main/INFO] [System Property] using.aikars.flags = https://mcflags.emc.gs
[main/INFO] [System Property] aikars.new.flags = trueThe two using.aikars.flags and aikars.new.flags properties confirm the flags loaded correctly.
Do They Actually Help?
Yes — measurably. The biggest improvement is reducing TPS lag spikes caused by JVM garbage collection pauses. Without these flags, you'll see periodic stutters every 30 seconds to a few minutes. With them, GC happens incrementally and players don't notice.
Common before/after:
| Without Aikar's | With Aikar's |
|---|---|
| GC pause: 200–500 ms every minute | GC pause: 20–50 ms every few seconds |
| TPS dips to 15 during GC | TPS stays at 19.5+ during GC |
| Players see "rubber banding" during pauses | Smooth gameplay |
Common Mistakes
| Mistake | Why It's Wrong |
|---|---|
| Over-allocating RAM | Giving 16 GB to a 4-player server makes GC pauses worse, not better. Match RAM to actual need |
| Mixing GC flags | Don't use Aikar's flags AND -XX:+UseConcMarkSweepGC or other GC settings — they conflict |
| Using old CMS collector | -XX:+UseConcMarkSweepGC is the legacy CMS collector that Aikar's flags specifically replace |
Forgetting -Xms = -Xmx | Min and max heap should match, e.g. -Xms6G -Xmx6G. Different values cause runtime resizing overhead |
Java Version Notes
Aikar's flags work on Java 8, 17, and 21. The G1 collector is available in all modern Java versions. No flag changes are needed across Java upgrades.
Reference
- Aikar's original blog post: aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft
- Updated flags reference: mcflags.emc.gs
Related Guides
How is this guide?
