"The server's lagging" can mean three different problems, and the fix for one does nothing for the others. Before you change any settings, work out which one you've got.
Three kinds of lag
- Server lag. The server can't keep up with the game. Mobs freeze then jump, blocks you break pop back, crops and furnaces slow down. Everyone on the server feels it at the same time.
- Network lag. The server is fine but the connection isn't. Only one or two players complain, and their ping in the player list (hold Tab) is high or jumping around.
- Client lag. Low frame rate on one player's computer. Press F3 and look at the FPS number. That's a graphics settings or hardware problem on their end, not the server's.
This note is about the first one.
TPS and MSPT
A Minecraft server runs 20 ticks a second. Each tick it moves mobs, runs hoppers and grows crops, and it has 50 milliseconds to do it.
- TPS (ticks per second) should sit at 20. Below that, the game runs in slow motion.
- MSPT (milliseconds per tick) is how long each tick actually takes. Under 50 is healthy. Over 50 and TPS starts dropping.
MSPT is the more useful number. A server at 45 MSPT still shows 20 TPS, but it's one mob farm away from lagging. A server at 10 MSPT has plenty of room.
Vanilla has had a built-in check since 1.20.3. Run this as an operator:
/tick query
It shows the target tick rate and the average and percentile tick times.
Use spark to find the cause
spark is the profiler everyone uses, and it's what Paper's own docs point you to. Paper has bundled it since 1.21, so on Paper it's already there. On Fabric or NeoForge, install the spark mod from Modrinth on the server.
Start with:
/spark tps
That prints TPS and tick durations (min, median, 95th percentile and max) plus CPU use. Watch the 95th percentile. If the median is fine but the 95th percentile is well over 50, you've got spikes: something heavy happening every so often rather than all the time.
Then run the profiler while the lag is actually happening:
/spark profiler start --timeout 300
After five minutes it gives you a link to a report. Open it, expand the server thread, and follow the biggest percentages down. You'll usually end up at entity ticking, block entities (hoppers, furnaces, modded machines), chunk generation, or one specific mod.
Two more commands worth knowing:
/spark health /spark gc
health shows CPU, memory and disk use. gc shows garbage collection pauses, which matter for the memory section below.
The usual causes
Too many entities
Mob farms, villager breeders, thousands of dropped items. Every entity costs time every tick. Villagers are among the most expensive because of their pathfinding and job-site checks.
If the profiler shows entity ticking at the top, go find the farm. Kill off excess mobs, put a cap on breeders, and make sure farm output goes into hoppers rather than piling up on the ground.
Redstone and hoppers
Big hopper chains and redstone clocks that never turn off run every tick, even when nobody is near them (as long as the chunk is loaded). Chunk loaders make this worse because they keep those chunks running all the time.
Chunk generation while exploring
Generating new terrain is one of the heaviest things a server does. One player flying an elytra in a straight line can drag the whole server down.
View and simulation distance set too high
These are two separate settings in server.properties:
view-distanceis how far chunks are sent to players to see.simulation-distanceis how far from each player mobs, crops and redstone actually run.
Both default to 10. Simulation distance is the expensive one, since the number of chunks grows with the square of the distance. Every player has their own area, so ten players spread out across the map cost a lot more than ten players at the same base.
Heavy mods
Some mods add a lot of work per tick: big tech mods with pipe networks, mods that add lots of mobs, anything that scans the world. The spark report will name them.
CPU single-thread speed
Most of a Minecraft server's game logic runs on one main thread. Single-core speed matters far more than core count, and it's the reason a cheap host with "8 vCPUs" can still lag with four players on.
Memory and garbage collection
Too little RAM and Java spends its time cleaning up memory instead of running the game, and you get regular stutters. Too much on a small server mostly wastes it. If /spark gc shows long or frequent pauses, memory is part of your problem. I go through sizing in how much RAM a Minecraft server needs.
Fixes that actually help
Pre-generate the world with Chunky
Chunky generates chunks ahead of time so nobody's exploring triggers it during play. It's available for Paper, Fabric, NeoForge and Forge. To generate a 5,000 block radius around spawn:
chunky world world chunky center 0 0 chunky radius 5000 chunky start
Run it while nobody's on, since it will use the CPU heavily. You can chunky pause and chunky continue at any time. Then set a world border at the edge so players don't walk past what's been generated:
/worldborder center 0 0 /worldborder set 10000
The border takes a diameter, so 10000 matches a 5000 radius.
Lower the simulation distance
This is the single best setting for most servers. Drop simulation-distance to 6 or so and leave view-distance higher. Players still see far, but the server only runs the area near them. Restart the server after changing it.
Keep entities under control
- Set rules for farms and breeders, and check on them.
- On Paper,
paper-world-defaults.ymlhas a lot of options here:entities.spawning.alt-item-despawn-rateto clear junk items like cobblestone faster,chunks.entity-per-chunk-save-limitto cap things like experience orbs and arrows per chunk, andtick-rates.behaviorandtick-rates.sensorfor villager AI. - Also on Paper:
hopper.ignore-occluding-blocks,environment.optimize-explosions, andmisc.redstone-implementationset toALTERNATE_CURRENTfor redstone dust. That last one changes some redstone behaviour, so test it if your players build technical contraptions.
Use server performance mods on modded servers
Paper uses plugins, not mods, so these are for Fabric and NeoForge. All of them work on the server:
- Lithium speeds up game logic like mob AI, physics and block ticking without changing how the game plays. It's on both Fabric and NeoForge, with builds up to 26.3.
- FerriteCore cuts memory use, which means less garbage collection. Fabric and NeoForge, also up to 26.3.
- ModernFix helps with launch time and memory in big modpacks. Check it supports your version before adding it: right now its builds stop at 26.1.2.
Don't put client-side rendering mods like Sodium on the server. They do nothing there and some of them crash it, which I wrote about in why modded servers crash on startup. If you haven't picked a loader yet, Fabric vs NeoForge vs Paper covers how they compare.
When it's the host
Sometimes you do everything right and it still lags. Signs it's the hardware, not the world:
- The spark report has no clear culprit. Everything is just a bit slow.
- TPS drops with only a couple of players and a fresh, pre-generated world.
/spark healthshows high CPU use while your server process isn't busy, which means something else on the machine is.- Lag comes and goes at the same times of day, when other customers on the same box are busy.
Budget hosts often share one CPU across many servers. At that point a better plan or a different host fixes more than any config change. I run my servers through my own panel at mc.kimolo.dev on a machine at home, so I know exactly what else is using the CPU.
Need a hand?
If you've got a spark report and can't work out what it's saying, send it to me on Discord and I'll have a look. I also set up and run Minecraft servers if you'd rather not deal with it.
