If you have ever spent a late night trying to start a Minecraft server, you know the “TPS struggle.” You’ve picked the perfect minecraft server hosting, installed your favorite minecraft server plugins, and invited your friends—only to watch the “Ticks Per Second” (TPS) drop the moment someone loads a few chunks or breeds fifty cows.
Your hardware says you have 16GB of RAM. Your CPU is a modern beast. So why does the server still “stutter”? The answer usually isn’t the hardware; it’s the way Java manages that hardware.
In this A Deep Dive into Aikar’s Flags: The Science of JVM Optimization, we are going to look under the hood of the Java Virtual Machine (JVM). We will explore why “Aikar’s Flags” became the industry standard for the best minecraft servers and how you can use them to maintain a low lag minecraft server in 2026.
1. The Enemy of the State: Garbage Collection Lag
Minecraft is written in Java. Unlike languages like C++, where a developer manually manages memory, Java uses an automated system called the Garbage Collector (GC).
How Garbage Collection Works
As your public minecraft server runs, it creates millions of “objects”—block coordinates, entity metadata, and networking packets. Once these objects are no longer needed (like the data for a player who just logged off), they stay in your RAM as “garbage.”
The Garbage Collector’s job is to find this junk and throw it away to free up space.
- The Default Behavior: Standard Java settings wait until the memory is nearly full, then “Stop the World.” This freezes the entire server for several hundred milliseconds to perform a massive cleanup.
- The Result: A massive lag spike that players feel as “rubber-banding” or delayed block breaks.
2. What are Aikar’s Flags?
Created by Aikar, a legendary developer in the PaperMC community, these flags are a specific set of instructions for the JVM. They tell Java: “Don’t wait until the memory is full. Clean up the garbage in small, invisible pieces so the server doesn’t have to stop.”
In 2026, the standard set of flags for a modern public minecraft server looks like this:
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: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 -Daikar.for.v2=true -jar paper.jar nogui
3. The Science Behind the Flags: A Breakdown
To truly understand A Deep Dive into Aikar’s Flags: The Science of JVM Optimization, we need to break down the specific logic behind these commands.
The G1GC Algorithm (-XX:+UseG1GC)
The “Garbage-First” collector (G1GC) is the heart of Aikar’s strategy. Instead of treating your RAM as one giant bucket, G1GC divides it into small “regions.”
By dividing the heap into regions, the JVM can focus its cleaning efforts on the regions that are “mostly garbage” first, hence the name.
The Pause Target (-XX:MaxGCPauseMillis=200)
A Minecraft tick lasts 50 milliseconds ($1000ms / 20 TPS = 50ms$). While a 200ms target seems high, it is a “soft” goal. It tells the JVM to prioritize keeping cleanup pauses as short as possible, even if it has to run the cleaner more frequently.
The “Young Gen” Optimization (-XX:G1NewSizePercent=30)
Minecraft is a “high allocation” application. It creates and destroys millions of short-lived objects every second (like block positions). Aikar’s flags increase the “Young Generation” size to 30% of your total RAM. This gives these short-lived objects plenty of room to “live and die” without being promoted to the “Old Generation,” which requires much heavier cleaning.
The 100% RAM Myth (-XX:+AlwaysPreTouch)
One of the most common questions on minecraft server hosting forums is: “Why is my RAM usage at 100% when no one is online?”
This is caused by the AlwaysPreTouch flag. It tells the OS to allocate all the requested RAM immediately. This is actually a performance boost because it prevents the OS from “stalling” your server later when it needs more memory.
4. How to Apply Aikar’s Flags (Step-by-Step)
Whether you are using a VPS or dedicated minecraft server hosting, applying these is simple.
For Shared Hosting Users
- Access your hosting panel (Pterodactyl, Multicraft, etc.).
- Navigate to Startup Settings.
- Look for a field labeled “Additional Startup Flags” or “JVM Arguments.”
- Paste the flags, ensuring you adjust
-Xmxand-Xmsto match your plan’s RAM. - Expert Tip: Always leave about 1GB of “Headroom” for the OS. If your plan is 8GB, set your flags to 7GB.
For VPS/Dedicated Server Users
- Open your
start.shorstart.batfile. - Internal Link: If you haven’t set up your OS yet, read our guide on [The Best Linux Distros for Hosting a Minecraft Server].
- Replace your existing
java -jarline with the full Aikar command. - Run the server and use the Spark plugin to monitor the results.
5. Aikar’s Flags vs. ZGC: The 2026 Comparison
With the release of Java 21 and Java 24, a new challenger has appeared: ZGC (Z Garbage Collector).
| Feature | Aikar’s G1GC Flags | Generational ZGC |
| Ideal RAM | 4GB – 16GB | 16GB+ |
| Latency | Low (20ms – 100ms) | Ultra-Low (<1ms) |
| Complexity | Requires specific flags | Mostly automatic |
| Stability | Battle-tested for 10 years | New, requires high CPU |
Verdict: For 90% of minecraft servers, Aikar’s Flags on G1GC remain the superior choice. ZGC is incredible for massive networks (100+ players), but it requires significant CPU overhead that small servers can’t afford.
6. Common Mistakes and Expert Tips
- Mistake: Not matching Xms and Xmx. If you set
-Xms2Gand-Xmx8G, the JVM will constantly grow and shrink the memory pool, causing “hiccups.” Always set them to the same value. - Mistake: Using outdated Java. In 2026, you should be using Java 21 or higher. Older versions of Java 8 or 11 do not support the modern G1GC optimizations.
- Expert Tip: Use GraalVM. If your host allows it, run your server on GraalVM Community Edition. It’s a high-performance JIT compiler that works perfectly with Aikar’s Flags to squeeze even more TPS out of your hardware.
- Internal Link: Performance is just one part of the puzzle. Once your server is fast, learn [How to Attract Players to Your Minecraft Server].
FAQ: People Also Ask
Do Aikar’s Flags work on Bedrock servers?
No. These flags are for the Java Virtual Machine (JVM). If you are running a [Java vs Bedrock Server], these only apply to the Java side. However, if you use [GeyserMC], your Java server should definitely use these flags to support the translated Bedrock traffic.
Can these flags fix lag caused by bad plugins?
Not entirely. While these flags fix “memory lag,” they cannot fix a plugin that is poorly coded and hogging your CPU. Use the /spark profiler command to see if a specific plugin is the real culprit.
Is it safe to use these on a 2GB server?
Aikar’s Flags generally require at least 4GB of RAM to be effective. On very small servers (under 2GB), the G1GC “management overhead” might actually take up too much of your limited resources.
Conclusion: The Final Piece of the Puzzle
Understanding A Deep Dive into Aikar’s Flags: The Science of JVM Optimization is what separates amateur owners from professional admins. By taking the time to tune your JVM, you are ensuring that your players have the smoothest experience possible—no matter how many TNT blocks they ignite or how many [Cobblemon] they catch.

Leave a Reply