All Guides

Optimize Minecraft Server 2026: Aikar Flags, RAM & TPS Guide

Narrow down Minecraft server lag: JVM flags, garbage collection, world pre-generation and server configuration step by step.

Dirk Hesse
January 22, 2026
9 min read

Your Minecraft server lags despite enough RAM? Lag often has several causes: Java configuration, server settings, plugins and CPU performance.

In this guide we go through the key levers: from Aikar's flags in the PaperMC docs to world pre-generation with Chunky.

Found a server, but which VPS?

Use our calculator to find a suitable VPS for your player count.

To the Minecraft server calculator

Why Java flags matter

Minecraft runs on the Java Virtual Machine (JVM). Java regularly cleans up unused data in memory; this is called garbage collection (GC).

If a tick takes longer because of a GC pause, the next tick is delayed; you notice this as a short lag spike (spark docs, as of Nov 8, 2026).

Note: Since JDK 9, G1 has been the default collector on server-class machines; on very small systems the JVM may pick another (OpenJDK, as of Nov 8, 2026); Aikar's flags tune G1 for Minecraft servers.


Aikar's flags for G1

Aikar's flags are a set of JVM parameters that the PaperMC docs recommend for Paper servers (PaperMC docs, as of Nov 8, 2026). The docs recommend at least 6–10 GB of memory and about 1000–1500 MB of headroom to the host's RAM.

Flag set per the PaperMC docs, with an 8 GB heap:

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

Important: Set -Xms and -Xmx to the same value. Otherwise memory goes unused (PaperMC docs, as of Nov 8, 2026); for server deployments both are often set equal (Oracle Java docs, as of Nov 8, 2026).

What do the key flags do?

The table explains some parameters (Oracle Java docs, as of Nov 8, 2026):

FlagFunctionEffect
-Xms / -XmxMin/max heap sizeEqual values, the heap is not shrunk
-XX:+UseG1GCGarbage collector typeSelects G1 explicitly, also on small VPS
-XX:+AlwaysPreTouchCommit heap at startupTouches every heap page at startup, not on demand
-XX:MaxGCPauseMillis=200Pause time targetTarget of 200 milliseconds, a soft goal, not a hard limit

Generational ZGC for large heaps

Since JDK 21 there is Generational ZGC. Pauses are typically under one millisecond, at the cost of some throughput (OpenJDK, as of Nov 8, 2026).

With Java 25, -XX:+UseZGC is enough:

java -Xms16G -Xmx16G \
  -XX:+UseZGC \
  -XX:+AlwaysPreTouch \
  -XX:+DisableExplicitGC \
  -jar paper.jar --nogui

Tip: On Java 21 you also need -XX:+ZGenerational. The option is deprecated from JDK 23 and obsolete from JDK 24 (OpenJDK, as of Nov 8, 2026). Whether ZGC helps your server shows in a comparison of MSPT values with spark.


Which Java version?

The right Java version depends on your Minecraft version. For Paper, the docs give this mapping (PaperMC docs, as of Nov 8, 2026):

Paper versionRecommended Java version
1.17 - 1.19Java 17
1.20 - 1.21.11Java 21
26.1 and newerJava 25

Tip: Use the Java version that the PaperMC docs or your mod loader name for your Minecraft version.


Pre-generate the world with Chunky

A common source of load: the server has to create new chunks while players explore the world. Every new chunk means terrain calculation at runtime.

The fix: generate the world before play starts with Chunky. Chunky creates chunks in advance and runs on Paper, Spigot, Fabric, Forge and NeoForge, among others (Modrinth project page, as of Nov 8, 2026).

/chunky radius 5000
/chunky start
# Progress: /chunky progress

The commands are in the Chunky wiki (Chunky wiki, as of Nov 8, 2026); start begins right away, the default is a square around 0, 0.

How long does it take?

It depends on radius, CPU and disk; /chunky progress shows the status.

Note: After pre-generation the server loads existing chunks from disk instead of generating them again.


View distance vs. simulation distance

View distance determines how many chunks are loaded per player. view-distance is a radius in chunks, default 10, allowed 3 to 32 (PaperMC docs, as of Nov 8, 2026). The chunk count grows quadratically: in theory up to (2d + 1)² chunks per player.

View distanceChunks per player (in theory)
6169
8289
10441 (default)
12625
161089

Tip: A smaller simulation-distance shrinks the area in which entities are processed; outside it they are neither ticked nor visible according to the PaperMC docs (default 10, as of Nov 8, 2026).


Settings in server.properties

These server.properties settings affect the load; check with spark:

SettingEffect
view-distance=8in theory 289 instead of 441 chunks per player
simulation-distance=5in theory 121 instead of 441 chunks of simulation area

Do not turn off the watchdog (max-tick-time, default 60 seconds): -1 disables it entirely per the PaperMC docs, and a hung server is then no longer stopped (as of Nov 8, 2026).


Frequently Asked Questions

Do Aikar flags help on vanilla servers?
Aikar's flags are JVM parameters and can be set on any Java-based server software; the PaperMC docs describe them for Paper. Check the effect with spark.
Can I use Aikar flags with Fabric?
Yes, the flags are JVM parameters and work with any Java-based server software, including vanilla, Paper, Purpur, Fabric, Forge and NeoForge. They are described in the PaperMC docs.
Why does my server lag despite 16GB RAM?
According to the PaperMC docs, more memory stops improving performance at some point (as of Nov 8, 2026). Narrow down the cause with spark: plugins, chunk generation, entities or GC pauses.
Which Java version for Minecraft 1.21?
For Paper 1.21 the PaperMC docs recommend Java 21; from 26.1 they recommend Java 25 (as of Nov 8, 2026).
How much RAM do I need for a modded server?
The modpack itself usually states its RAM needs; for Paper servers the PaperMC docs recommend 6–10 GB or more. The Minecraft calculator estimates it for your player count.

Plugin & server configuration for more TPS

Java flags affect memory management; with many players or mobs, the server configuration is worth a look too. If you use Paper (or a fork such as Purpur), three files are worth checking:

  • spigot.yml – entity activation range: Outside the range, entities tick less often (default animals and monsters 32 blocks each, PaperMC docs, as of Nov 8, 2026). Lower values step by step and check with spark.
  • bukkit.yml – spawn limits: Lower spawn-limits cap the number of mobs (default monsters 70, animals 10; the Paper world config can override them, PaperMC docs, as of Nov 8, 2026).
  • config/paper-world-defaults.yml – mob spawning & tick rates: entities.spawning.per-player-mob-spawns (default true) sets the mob cap per player instead of per server; the tick-rates section controls e.g. grass-spread, mob-spawner and container-update (PaperMC docs, as of Nov 8, 2026).

A common mistake: too many plugins. Many plugin tasks run on the server thread and lengthen the tick. Disable what you do not need and prefer actively maintained plugins.

Monitor TPS

Optimizing without measuring is guessing. The target is 20 ticks per second, i.e. one tick every 50 milliseconds (spark docs, as of Nov 8, 2026). /spark tps shows TPS and CPU usage; for deeper analysis use the open-source profiler spark:

/spark profiler start --timeout 60

The syntax is in the spark docs (spark docs, as of Nov 8, 2026). The report shows which plugins or tasks on the server thread take a lot of CPU time. That way you find the real bottleneck instead of turning settings blindly.


How much RAM does the server need?

More RAM is not automatically better: per the PaperMC docs, more memory stops helping at some point (as of Nov 8, 2026).

For Paper the docs recommend 6–10 GB or more; the Minecraft calculator estimates what your player count needs.

Besides RAM the CPU counts: per the spark docs, ticks run one after another on the server thread, not in parallel; so per-core performance matters (as of Nov 8, 2026). Look at both when choosing a VPS.


Conclusion

The key levers at a glance:

  1. Use Aikar's flags per the PaperMC docs – with equal -Xms and -Xmx
  2. Consider Generational ZGC – an alternative for large heaps
  3. Pre-generate the world – generate chunks ahead with Chunky
  4. Separate view and simulation distance – set them separately

Frequently Asked Questions

What does TPS mean and which value is good?
TPS (ticks per second) measures how often the server calculates the game world per second. 20 TPS is the target, one tick every 50 milliseconds. If a tick takes longer, the next one is delayed and the game stutters (spark docs, as of Nov 8, 2026). Check the current value with /spark tps.
More RAM or a faster CPU – which helps more?
That depends on the bottleneck: ticks run one after another on the server thread, so per-core performance matters; per the PaperMC docs, more RAM stops helping at some point. spark shows the bottleneck.
Do Aikar flags help on every server?
Aikar's flags are what the PaperMC docs recommend for Paper; Generational ZGC is an alternative for large heaps. Compare both under load with spark.

Found a server, but which VPS?

Use our calculator to find a suitable VPS for your player count.

To the Minecraft server calculator

Related Articles