Minecraft servers often face sudden lag spikes when Java pauses the game to clear out memory. Aikar flags eliminate these stutters by optimizing the garbage collector to process temporary data in rapid bursts without resizing memory during gameplay. In this Apex Hosting guide, explore how these parameters stabilize your server ticks-per-second and grab optimized startup flags ready for your multiplayer server.
What Do Aikar Flags Do?
Aikar’s flags configure Java’s garbage collector so Minecraft servers clean up unused memory in frequent bursts instead of occasional longer freezes. The game constantly creates temporary data (entities, packets, chunks). These flags give that temporary data more room to disappear quickly, limit pause length to roughly 200 ms, and prevent plugins from forcing full cleanups.
Setting the minimum and maximum memory to the same values stops the server from resizing its RAM allocation mid-game, which itself causes stutters. The result is smoother TPS with fewer noticeable lag spikes from memory cleanup.
What Are The Best Startup Flags?
Here’s a clean breakdown of the best JVM startup flags for Minecraft Java servers:
| Startup Flag | Definition / Purpose |
|---|---|
-Xms / -Xmx |
How much RAM the server is allowed to use. Set them the same so Java doesn’t keep resizing memory (which causes stutters). |
-XX:+UseG1GC |
Use a smarter cleanup method that cleans in small pieces instead of big freezes. |
-XX:MaxGCPauseMillis=200 |
Try not to freeze the server longer than 0.2 seconds during cleanup. |
-XX:+DisableExplicitGC |
Stop plugins from forcing a big full cleanup (some poorly written ones do this and cause lag spikes). |
-XX:+AlwaysPreTouch |
Grab all the allowed RAM right when the server starts, so it doesn’t stutter later when players join. |
-XX:+ParallelRefProcEnabled |
Let cleanup use multiple CPU cores instead of just one. |
Young-gen size flags (G1NewSizePercent, G1MaxNewSizePercent) |
Give more room to temporary objects so they get cleaned quickly before they become permanent. |
-XX:MaxTenuringThreshold=1 + SurvivorRatio |
Quickly decide what is temporary vs long-lived so less time is wasted copying data around. |
-XX:G1HeapRegionSize |
Size of the memory chunks Java works with (prevents certain big objects from causing problems). |
-XX:+PerfDisableSharedMem |
Stop Java from writing performance stats to disk (can cause tiny freezes if the disk is busy). |
-XX:+UnlockExperimentalVMOptions |
Just unlocks some of the other settings above. The rest are fine-tuning numbers. |
Recommended JVM Startup Flags
Each Minecraft server has a different amount of RAM, which determines the JVM startup flags. With this in mind, here’s our top picks for popular server choices:
4 GB Minecraft Server
-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
8 GB Minecraft Server
-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
12 GB Minecraft Server
-Xms12G -Xmx12G -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
13+ GB Minecraft Server
Change only the -Xms/-Xmx values to match your heap (memory).
-Xms13G -Xmx13G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1
Hosting Your Own Minecraft Server
Applying Aikar flags provides the memory management needed to keep your server running at a solid 20 TPS. While you can configure these startup parameters on local hardware, hosting with Apex Hosting takes the technical headache out of server management. If you need additional JVM arguments, you can add them in just a few clicks. Launch your own server with us to save time – create a smooth, uninterrupted multiplayer experience with friends 👏
Otherwise, click here to learn more about self-hosting a Minecraft server.



























