CYBER DEAL UP TO -40% FIRST YEAR
Glossary background texture

Aikar's Flags

Aikar’s Flags for Minecraft Servers Explained

Aikar's Flags are a popular set of pre-tuned JVM (Java Virtual Machine) flags created by Aikar to improve Minecraft server performance and reduce garbage collection pauses.

By optimizing how Java manages memory, these flags can significantly reduce lag spikes and create a smoother experience without touching server's game settings.​

These flags were created by Aikar (a PaperMC developer) specifically to tune the G1 Garbage Collector (G1GC) for Minecraft's unique memory patterns. They control things like how often garbage collection runs, how long it's allowed to pause the server, and how memory is allocated across different generations.​

Aikar’s Flags are mainly used on Paper servers and the official Paper docs recommend these flags as the baseline JVM config for most Paper servers.


How Aikar's Flags Work

Your server is constantly loading chunks, spawning mobs, saving player data and running plugins. All of that uses memory (RAM).

Over time, that memory fills up with stuff the server doesn't need anymore: old chunks, dead or removed entities, expired effects.

Memory (RAM) before any cleanup
💡
"Junk" is everything that is "no longer used". For example: pathfinding calculations for a mob that has already moved can be thrown away.

Garbage Collector

Java has a built-in "cleaner" that goes through and throws this junk away. That cleaner is called the Garbage Collector (GC).

When the GC is cleaning, it basically says: “Everybody stop for a second while I clean this mess up.”

Big cleanups = noticeable lag spikes.

Garbage collector running to clean up junk and turn it into free RAM

Once that quick cleanup is done your server has now more free RAM. If Java never cleaned up old stuff, your RAM would just fill up until TPS tanks, JVM throws an "Out of Memory" error and then server crashes.

Memory (RAM) after cleanup

By default, Java's garbage collector isn't optimized for Minecraft servers, which can cause noticeable lag spikes during the pauses and that's where Aikar's Flags come in.

Aikar's Flags

Aikar’s Flags are a bunch of advanced startup settings for Java that tell this cleaner how to work so it doesn’t ruin your gameplay.

Aikar Flags:

  • Make cleanups shorter: Instead of one big freeze, you get tiny, almost unnoticeable cleanups.
  • Make cleanups happen more often: The server cleans a bit but often.
  • Prepare memory in advance: When the server starts, it prepares the RAM so it’s ready to be used efficiently.
  • Use CPU cores better: The cleanup job is split across cores so it finishes faster and causes smaller pauses.
Server Time with and without Aikar's flags

The result is smoother gameplay with fewer noticeable lag spikes, especially during intensive operations like chunk generation or entity-heavy farms.


What Aikar’s Flags don’t do

Aikar’s Flags aren’t a magic /fixlag button. They only tune how Java cleans up memory, they don’t:

  • Fix a server with not enough RAM
  • Fix terrible plugins or badly coded mods
  • Turn a bad CPU into a great CPU

Aikar’s Flags are like giving Java’s “cleaning lady” better instructions so she tidies the server quietly in the background instead of walking in, turning on all the lights, and making everyone stop while she vacuums.


Key Flags Explained

Here's what some of the most important flags do:​

Flag Description
-XX:+UseG1GC Tells Java to use the G1 garbage collector, which is much better for Minecraft servers than the default one.
-XX:MaxGCPauseMillis=200 Asks Java to keep cleanup pauses under 200 ms. That’s short enough that most players barely feel it as a tiny stutter instead of a full freeze.
-XX:+DisableExplicitGC Stops badly coded plugins from forcing their own big cleanups at terrible times. It’s like telling plugins: “You don’t get to slam the pause button whenever you want.”
-XX:+AlwaysPreTouch Fully prepares the server’s RAM when it starts, instead of slowly grabbing bits of it later. Startup might take a bit longer, but gameplay is more stable
-XX:+ParallelRefProcEnabled Lets Java do part of the cleanup work on multiple CPU cores at once, so garbage collection finishes faster and causes shorter pauses.

How to Enable Aikar's Flags

Most modern hosting providers (including WiseHosting) apply Aikar Flags by default. If you need to apply them manually:​

  1. Access your server's startup settings in your control panel​
  2. Locate the JVM arguments or startup parameters section
  3. Replace the existing flags with Aikar's flags from the official documentation​
  4. Adjust the RAM values to match your server's allocated memory​
  5. Restart your server for the changes to take effect​
Don't miss out

CYBER DEAL
UP TO -40%

Host a Minecraft Server today with the best Cyber deal discount

  • -40% First Month
  • -10% First Quarter
  • -40% First Year