Fix Lag on Your Minecraft Server: How to Get 20 TPS
Measure with spark, lower simulation distance, get mobs, hoppers and redstone under control - and learn why more RAM is rarely the answer.
Two numbers you need to know: TPS and MSPT
- TPS (ticks per second) is how many times per second the server updates the world. 20 is the maximum - the server can never run faster, only fall behind.
- MSPT (milliseconds per tick) is how long one tick took. The budget is 50 ms. When a tick takes longer than that, TPS drops.
MSPT is the better metric. A server at 45 ms and one at 5 ms both report 20.00 TPS - but the first one is one mob farm away from collapsing. TPS tells you it already went wrong; MSPT tells you how close you are.
Step 1 - Measure before you change anything
Never guess. Run the measurements first:
| Command | What you get |
|---|---|
/tps |
TPS averaged over 1, 5 and 15 minutes |
/mspt |
Average, minimum and maximum MSPT |
/paper mobcaps |
How close the world is to the mob cap |
/paper chunkinfo |
Number of loaded chunks |
spark is the real tool, and it is bundled with Paper from 1.21:
/spark tps
/spark health
/spark profiler start --timeout 600
The profiler runs for 10 minutes and gives you a link to a report showing exactly which plugin or task is spending the time. If you only get occasional spikes, add --only-ticks-over 50 and capture just the slow ticks.
Timings is deprecated and disabled by default in newer Paper versions. Use spark.
Step 2 - Lower simulation-distance (the single biggest win)
In server.properties there are two settings people constantly mix up:
| Setting | Default | Recommended | What it controls |
|---|---|---|---|
view-distance |
10 |
7 |
How far players can see. Costs bandwidth |
simulation-distance |
10 |
4 |
How far the server thinks: mobs, redstone, crops. Costs CPU |
simulation-distanceis what costs you TPS. Dropping it to 4 is barely noticeable to players - they still see far, the distant world simply stands still. Simulation distance is meant to be lower than view distance.
Step 3 - Get mobs and entities under control
bukkit.yml in the server root:
| Key | Default | Recommended |
|---|---|---|
spawn-limits.monsters |
70 |
20 |
spawn-limits.animals |
10 |
5 |
spawn-limits.ambient |
15 |
1 |
ticks-per.monster-spawns |
1 |
10 |
ticks-per.water-spawns |
1 |
400 |
Two things get misunderstood here: the limits are multiplied by the player count, so 70 monsters with 40 players is an enormous number. And
ticks-peris the interval between spawn attempts - a higher number means less work.
spigot.yml in the root folder:
| Key | Default | Recommended |
|---|---|---|
entity-activation-range.animals |
32 |
16 |
entity-activation-range.monsters |
32 |
24 |
entity-activation-range.misc |
16 |
8 |
entity-activation-range.flying-monsters |
32 |
48 |
mob-spawn-range |
8 |
3 |
nerf-spawner-mobs |
false |
true |
tick-inactive-villagers |
true |
false |
entity-activation-range decides how far from a player a mob still gets AI and pathfinding. It is the most effective lever after the distance settings. Do raise flying-monsters, though, or phantoms and ghasts freeze in mid-air.
Keep mob-spawn-range at or below your simulation-distance.
Step 4 - Items, hoppers and redstone
In spigot.yml:
merge-radius:
item: 3.5
exp: 4.0
ticks-per:
hopper-check: 8
In config/paper-world-defaults.yml:
| Key | Recommended | Effect |
|---|---|---|
entities.spawning.alt-item-despawn-rate.enabled |
true |
Junk like cobblestone despawns faster |
entities.armor-stands.tick |
false |
Armor stands stop costing tick time |
entities.behavior.update-pathfinding-on-block-update |
false |
Large win on servers with many mobs |
hopper.disable-move-event |
true |
Big win - only if no plugin listens to InventoryMoveItemEvent |
collisions.max-entity-collisions |
2 |
Less work when mobs stack up |
misc.redstone-implementation |
ALTERNATE_CURRENT |
Noticeably faster redstone |
chunks.prevent-moving-into-unloaded-chunks |
true |
Stops elytra players outrunning chunk generation |
Step 5 - RAM and Java
- Set
-Xmsand-Xmxto the same value. A growing heap creates GC work, and GC work is a lag spike. - Do not allocate all your RAM. Java needs memory outside the heap too. With 8 GB available, give the server around 6.5-7 GB.
- Use Aikar's flags - the recommended JVM setup from PaperMC. The current string is at docs.papermc.io/paper/aikars-flags.
Java version by server version:
| Minecraft version | Java |
|---|---|
| 1.17 - 1.19 | Java 17 |
| 1.20 - 1.21.11 | Java 21 |
| 26.1 and newer | Java 25 |
More RAM does not fix low TPS. TPS is a CPU problem. RAM only helps if
/spark healthor/spark gcshows real memory pressure.
Step 6 - Pregenerate the world
Chunk generation is the most expensive thing a Minecraft server does. If your world is not generated in advance, you pay that bill every time a player flies somewhere new.
Install the Chunky plugin and run:
/chunky world world
/chunky center 0 0
/chunky radius 5000
/chunky start
Run it while the server is empty - the generation itself eats all the performance while it works. Afterwards, set a world border so players do not simply fly outside it again.
What does not help
- More RAM on its own. Only buy more if the measurements show memory pressure.
/reload. Java cannot safely reload code. The command leaves old listeners and scheduled tasks running alongside the new ones. Restart instead.- More CPU cores. The server tick loop is largely single-threaded - clock speed matters more than core count.
- Pasting a ready-made "optimised config". Several popular tweaks change gameplay. Fix what the measurement points at.
Troubleshooting
| Symptom | Likely cause | Next step |
|---|---|---|
| TPS drops when many players are online | Simulation distance too high | Set it to 4 and measure again |
| TPS drops at fixed intervals | Autosave or a plugin task | /spark profiler start and see what runs |
| Lag spikes but a healthy average | Individual long ticks | /spark profiler start --only-ticks-over 50 |
| The server lags when someone flies | Chunk generation | Pregenerate with Chunky |
| TPS decays over time after a restart | Entity or item build-up | /paper mobcaps, check your farms |
| Constantly low TPS regardless of players | A plugin is blocking the main thread | spark report, remove plugins one at a time |
Cannot read your spark report? Send us the link in a ticket and we will go through it with you.