Aikar's Flags: Peak Server Performance
Aikar's Flags are a set of optimized Java startup parameters that minimize "Garbage Collection" (GC) lag spikes. This is the single most important technical step for any server with more than 5 players.
The Flags (Copy/Paste)
Replace {Xmx} and {Xms} with your server's RAM amount (e.g., 8G):
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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar nogui
Why Use These Flags?
- Reduced GC Latency: Standard Java stop-the-world collections cause the "Server Can't Keep Up" error. These flags make those collections happen in tiny, unnoticeable chunks.
- Pre-Touch RAM:
-XX:+AlwaysPreTouchforces the OS to allocate all requested RAM at startup, preventing lag later when players join. - G1GC Tuning: Specifically tuned for the high object-churn rate of Minecraft's ticking engine.
Where to Put Them?
If you are using a Management Panel (like Pterodactyl/Wings), these are usually set in the "Startup" tab under "Commands" or "JVM Flags".
If you are on Windows, put them in your run.bat file before the -jar argument.
Warning: Always ensure -Xmx (Max RAM) and -Xms (Min RAM) are the same value. This prevents the JVM from resizing the heap, which is a major source of lag.