Aikar's Flags: best JVM arguments for Minecraft

Java's default garbage collector is not optimized for Minecraft servers. Aikar's flags configure the G1 garbage collector to minimize lag spikes caused by garbage collection pauses. They are the standard for every Paper and Spigot server.

The flags

java -Xms10G -Xmx10G -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:G1MixedGCCountTarget=4
-XX:InitiatingHeapOccupancyPercent=15
-XX:G1MixedGCLiveThresholdPercent=90
-XX:G1RSetUpdatingPauseTimePercent=5
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem
-XX:MaxTenuringThreshold=1 -jar server.jar --nogui

Replace 10G with your allocated RAM (e.g., 4G, 8G, 16G).

Why Xms must equal Xmx

-Xms is the initial heap size. -Xmx is the maximum. When they differ, Java spends time growing the heap under load, causing lag spikes. Setting them equal forces Java to allocate all memory at startup, eliminating resize pauses.

What the key flags do

  • UseG1GC: switches from the default garbage collector to G1, which handles large heaps better.
  • MaxGCPauseMillis=200: tells G1 to aim for pauses under 200 ms. It will not always achieve this, but it tries.
  • G1NewSizePercent=30 / G1MaxNewSizePercent=40: allocates 30 to 40% of the heap to new objects. Minecraft creates many short-lived objects (chunks, packets, entity data).
  • AlwaysPreTouch: commits all memory pages at startup. Prevents the OS from lazily allocating pages during gameplay.
  • DisableExplicitGC: prevents plugins from calling System.gc(), which triggers full GC pauses.
  • SurvivorRatio=32: large survivor space to keep objects in young generation longer before promoting them.
  • MaxTenuringThreshold=1: promotes objects to old generation after just one GC cycle. Minecraft objects are either very short-lived or permanent.

How to apply

In the HostValues game panel: go to Startup, find the Java Arguments field, and paste the flags (without java and -jar server.jar; the panel adds those). On a VPS: edit your start script.

For 12 GB+ servers

If you have 12 GB or more RAM, change one setting:

-XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50

This gives more room for new objects, which benefits large servers with many players.

Do Aikar's flags work with Fabric or Forge?

Yes. The flags configure the JVM, not the server software. They work with Paper, Spigot, Fabric, Forge and NeoForge.

Can these flags fix TPS issues?

They fix lag spikes caused by garbage collection, which appear as periodic freezes (every 30 to 60 seconds). They do not fix TPS issues caused by plugins, redstone or too many entities.

Are there better flags for Java 25?

Aikar's flags work well on Java 25. Some server owners experiment with ZGC (-XX:+UseZGC), which promises sub-millisecond pauses. ZGC is worth testing on 16 GB+ servers, but G1 with Aikar's tuning remains the proven standard.

Set JVM flags on any Minecraft plan at HostValues through the Startup tab.


Still stuck? Open a support ticket and our team will help you out.

Back to the blog