Minecraft server JVM flags generator

Choose how much memory the server gets and copy a start script with the well-known Aikar flags.

start.sh
#!/bin/sh
java -Xms4G -Xmx4G -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=true -jar server.jar --nogui

What the main flags do

-Xms / -Xmx
Start and maximum memory. Setting them equal avoids the server resizing its memory while players are on.
-XX:+UseG1GC
The garbage collector made for large heaps with short pauses.
-XX:MaxGCPauseMillis=200
Aim for cleaning pauses of 200 ms or less (a tick is 50 ms).
-XX:+AlwaysPreTouch
Reserve the memory at start so the first minutes are smooth. It slows the start by a few seconds.
-XX:+DisableExplicitGC
Stops plugins from forcing a full clean-up, which freezes the game.
-XX:G1NewSizePercent … G1ReservePercent
How the heap is divided so that the short-lived objects Minecraft makes constantly are cleaned cheaply.

Where these flags come from

These are the G1 garbage collector settings popularised by Aikar, a long-time Paper developer, tuned for how a Minecraft server uses memory: lots of small short-lived objects and a steady need for pauses shorter than a tick. Above 12 GB a slightly different set is recommended, which this tool switches to.

Questions

Do I need these flags?

They help most on Paper with 4 GB or more and many players. A tiny server runs fine without them. Never give Java all of the machine's memory: leave about 1 GB for the system.

How much memory should I set?

Use the RAM calculator for a first number. More is not always better: a huge heap can make cleaning pauses longer.

Do I need them on Saryno?

No. Saryno starts the game with flags chosen for each Java version and sets the memory for you from the size you pick.

Which Java do they work with?

Java 17 and newer all accept them. Some flags are ignored on very old Java without an error.

Related guides

More free tools

Ready to run it?

1 GB is free forever, with no card and no ads. Add memory when you need it.

Make a free server