Minecraft JVM flags (better known as Aikar's flags) are a set of Java launch arguments that tune the garbage collector so your server doesn't "freeze" for a fraction of a second every few minutes. A plain launch via java -Xmx leaves the defaults in place — and those defaults are exactly what give you a wobbling TPS and stutters. The ready-made flag string, how to apply it, and realistic expectations are all below.
Why a default server launch stutters
A Minecraft server is written in Java and runs inside the JVM — a virtual machine that manages memory for you. Objects (chunks, entities, items) are constantly created and destroyed, and freeing that memory is the job of the garbage collector (GC). Modern Java uses the G1GC collector by default, and it's decent — but its default settings are tuned for "average" server software, not for a game loop that has to fit inside 50 ms per tick.
The main pain point is stop-the-world pauses. To clean out garbage safely, the GC briefly halts all of the server's worker threads. If one of those pauses drags on for 150–300 ms, the main thread doesn't finish its tick, and you get the classic freeze: mobs stutter, blocks place with a delay, players get "rubber-banded" back. In the console this often shows up as lines like Can't keep up! Is the server overloaded?.
If you're building a server from scratch, keep this in mind right from the setup stage — the how to create a Minecraft server guide covers the basics, and flags are the next layer of optimization on top of them.
TPS (ticks per second) is how many game ticks the server completes per second; 20 is the ideal. MSPT (milliseconds per tick) is how long a single tick takes; as long as MSPT stays under 50 ms, TPS holds at 20. A long GC pause instantly pushes one tick past 50 ms — and that's the freeze.
What Aikar's flags actually do
Aikar's flags are a carefully tuned set of JVM arguments from the Paper developer known as Aikar. The idea is simple: instead of letting G1GC hoard garbage and then clear it in big "bursts," the flags make the collector run more often, but in small batches. Each individual pause comes out short and predictable, the pause target is hard-set to 200 ms, and in practice most pauses land within single-digit to low-double-digit milliseconds.
The key principles baked into this set:
- -Xms equal to -Xmx. Java doesn't waste time gradually "growing" the heap and reserves the full amount up front — memory doesn't swing, so pauses are steadier.
- Eager memory allocation (
AlwaysPreTouch). The whole heap is touched at startup rather than lazily during play, where it would cause micro-stalls. - A large young generation (
G1NewSizePercent=30,G1MaxNewSizePercent=40). For Minecraft's allocation pattern this sharply cuts the frequency of expensive collections. - Parallel reference processing (
ParallelRefProcEnabled) and disabling explicit GC (DisableExplicitGC), so a badly written plugin can't trigger a full collection by callingSystem.gc().
The full Minecraft JVM flags string
Here's the current Aikar's flags string. Change only two values — -Xms and -Xmx (they must be equal) — and leave everything else as is. The example shows an 8 GB heap; plug in your own amount.
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 server.jar --nogui
Aikar's official recommendation: if you allocate 12 GB or more to the server, bump the region size up to -XX:G1HeapRegionSize=16M and raise G1NewSizePercent to 40 and G1MaxNewSizePercent to 50. For heaps up to 12 GB, the values in the string above are optimal.
How to apply the flags
Where exactly you paste this string depends on how your server is launched.
In the control panel (Pterodactyl)
On Elysium your server runs in the Pterodactyl panel, and most of the arguments are already set in the startup parameters. The JVM flags live in the JVM Arguments variable (or the startup-command field) — that's where you paste the whole block of -XX:... flags, while -Xms/-Xmx are usually filled in automatically by the panel from your chosen memory limit. After saving, just restart the server so the new config takes effect.
In the startup script (your own VPS)
If you launch the server by hand from start.sh or start.bat, the entire string is your launch command. On Windows, drop the backslashes (\) — they only exist to break the line in bash — and write the command on a single line. Make sure you're on Java 17 or newer: on older versions some of the experimental flags simply won't be recognized.
Don't duplicate -Xmx, and don't leave an old flag like -XX:+UseConcMarkSweepGC alongside -XX:+UseG1GC — the JVM won't start with two garbage collectors at once, and the server will crash with an error on launch. Always keep exactly one block of flags.
How much RAM to set in -Xms and -Xmx
The temptation to hand the server all available memory is strong, but it backfires. Java spends memory beyond the heap: metaspace, thread stacks, off-heap NIO buffers (which is exactly how chunks get loaded). Plus the operating system itself needs headroom. If you set -Xmx to the ceiling of physical memory, the process will hit the limit under peak load and the OOM killer will take it down.
| Plan memory | Sensible -Xms=-Xmx | Good for |
|---|---|---|
| 4 GB (Common) | 3 GB | Vanilla / Paper, up to 10–15 players |
| 6 GB (Pulse) | 5 GB | Paper with plugins, light modpacks |
| 8 GB (Nexus) | 6–7 GB | Medium modpacks, an active core |
| 12 GB (Apex) | 10 GB | Heavy CurseForge/FTB modpacks |
| 16 GB (Titan) | 13–14 GB | Large modpacks, proxy networks |
The key rule: -Xms always equals -Xmx, and it's not all of the server's memory but a portion of it, with 1–2 GB held back for the system. If you're not sure how much your modpack actually needs, there's a dedicated breakdown — how much RAM a Minecraft server needs. And bear in mind: on a host with no overselling, like ours, the allocated memory is genuinely yours — on Elysium plans that's real DDR5, not "shared" RAM that neighbors steal from you.
When flags no longer help
Aikar's flags solve one specific problem — garbage-collection freezes. If TPS still sags after you apply them, and a profiler shows high MSPT without noticeable GC pauses, then the bottleneck isn't memory — it's the CPU. Minecraft runs almost its entire main loop on a single thread, so what matters to it isn't "many cores" but a high clock speed on one core.
Typical reasons for a CPU bottleneck: too high a view-distance, overloaded hoppers and redstone farms, heavy mods, surplus plugins, hundreds of active entities. Flags are powerless here — you need to profile the server (for example, with spark) and remove the source of the load. The full breakdown is in the why your server lags and how to fix it guide. Your choice of a lightweight core matters a lot too: the Paper, Purpur, and Vanilla comparison will help you see where you can claw back ticks without a hardware upgrade.
A word about ZGC
For very large heaps (roughly 12–16 GB and up), G1's pauses start to grow, and that's when it's worth looking at the ZGC collector (-XX:+UseZGC). It's built for sub-millisecond pauses almost regardless of heap size, but in return it takes more CPU and RAM for its internal structures. For a typical 4–10 GB server it's overkill — there, Aikar's flags on G1GC stay the best choice. Switch to ZGC deliberately, and always compare TPS before and after under your own workload.
Myths about JVM flags
"The bigger the -Xmx, the better." No. A larger heap is more memory the collector has to chew through in one go — meaning longer pauses. Allocate exactly as much as your modpack really needs, plus a small buffer.
"Flags will make up for a weak host." Also no. Aikar's flags are fine-tuning on top of decent hardware, not a replacement for it. If the provider has a slow disk and chunks load with a delay, or the CPU core is weak and a single thread isn't enough, no flags will cure that. Good optimization starts with choosing the right platform — covered in detail in the how to choose Minecraft hosting guide.
Aikar's flags pay off most on hardware with a fast single core and honest memory. With us that's an AMD Ryzen 9 boosting to 5.0+ GHz, DDR5 with no overselling, and NVMe Gen4 — worlds and chunks read at around 7 GB/s and don't drag TPS down during garbage collection. Build a server with the RAM you need and the right core, and the flags are already filled in within the panel — all that's left is to start it.
The bottom line is simple: paste the proven flag string, set -Xms=-Xmx with headroom for the system, restart the server — and the garbage-collection freezes are gone. If the lag persists, the problem is in the CPU or your configuration, and that's where you need to dig next.