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 calculatorWhy 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
-Xmsand-Xmxto 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):
| Flag | Function | Effect |
|---|---|---|
-Xms / -Xmx | Min/max heap size | Equal values, the heap is not shrunk |
-XX:+UseG1GC | Garbage collector type | Selects G1 explicitly, also on small VPS |
-XX:+AlwaysPreTouch | Commit heap at startup | Touches every heap page at startup, not on demand |
-XX:MaxGCPauseMillis=200 | Pause time target | Target 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 version | Recommended Java version |
|---|---|
| 1.17 - 1.19 | Java 17 |
| 1.20 - 1.21.11 | Java 21 |
| 26.1 and newer | Java 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 distance | Chunks per player (in theory) |
|---|---|
| 6 | 169 |
| 8 | 289 |
| 10 | 441 (default) |
| 12 | 625 |
| 16 | 1089 |
Tip: A smaller
simulation-distanceshrinks 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:
| Setting | Effect |
|---|---|
view-distance=8 | in theory 289 instead of 441 chunks per player |
simulation-distance=5 | in 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?
Can I use Aikar flags with Fabric?
Why does my server lag despite 16GB RAM?
Which Java version for Minecraft 1.21?
How much RAM do I need for a modded server?
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: Lowerspawn-limitscap 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; thetick-ratessection controls e.g.grass-spread,mob-spawnerandcontainer-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:
- Use Aikar's flags per the PaperMC docs – with equal
-Xmsand-Xmx - Consider Generational ZGC – an alternative for large heaps
- Pre-generate the world – generate chunks ahead with Chunky
- Separate view and simulation distance – set them separately
Frequently Asked Questions
What does TPS mean and which value is good?
More RAM or a faster CPU – which helps more?
Do Aikar flags help on every server?
More Minecraft Guides
Found a server, but which VPS?
Use our calculator to find a suitable VPS for your player count.
To the Minecraft server calculator

