The Best JVM Flags to Optimize Minecraft Server Performance
A practical breakdown of the JVM startup flags that actually reduce Minecraft server lag and GC pauses, and the ones you can safely skip.
The Best JVM Flags to Optimize Minecraft Server Performance
Minecraft servers run on Java, which means the Java Virtual Machine (JVM) startup flags you use have a real, measurable effect on lag, memory stability, and how gracefully your server handles garbage collection (GC) pauses. Most players never touch these settings โ which is exactly why a properly tuned server stands out.
Why Garbage Collection Is the Real Enemy
Every few seconds, the JVM has to clean up unused memory. On a poorly tuned server, this shows up as a sudden freeze โ everyone lags for half a second at the same time. The goal of flag tuning isn't more RAM, it's smoother, shorter, more predictable GC pauses.
A Solid Starting Point (Aikar's Flags)
Most experienced admins start from a well-known flag set (often called "Aikar's flags") built around the G1 garbage collector, tuned specifically for Minecraft's memory allocation pattern. These flags:
- Keep GC pause targets low and consistent
- Reserve heap region sizes tuned for Minecraft's object churn
- Avoid the long "stop-the-world" pauses older GC algorithms cause
Common Mistakes
- Allocating too much RAM. Giving a server 16GB when it only needs 6GB doesn't speed it up โ it just gives the GC a bigger pile to clean, which can make pauses longer.
- Mixing GC algorithms randomly. Copy-pasting flags from different guides can conflict. Pick one tuned set and stick with it.
- Ignoring
-Xmsand-Xmx. Setting the same value for minimum and maximum heap prevents the JVM from constantly resizing memory mid-game.
Where the CPU Comes In
Flags only get you so far. Minecraft is still single-thread heavy, so no amount of JVM tuning replaces a fast, high-clock-speed core. Every plan on RepublicNodes runs on NVMe storage with cores selected for single-thread performance, so tuned flags actually have fast hardware to work with instead of fighting a slow CPU underneath.
Quick Checklist
- Use a proven, Minecraft-tuned G1GC flag set
- Set
-Xmsequal to-Xmx - Size RAM to your actual player count and plugin/mod load, not a guess
- Pair tuning with fast, high-clock hardware โ flags can't fix slow cores
If your server is still lagging after tuning flags correctly, it's usually a hardware or plugin problem, not a JVM problem. See our guide on reducing Minecraft server lag and TPS drops for the next steps.