Four kinds of lag, four different fixes
| What players see | What it usually is | Where to look |
|---|---|---|
| Blocks reappear, mobs teleport, everyone lags at once | Server lag: TPS below 20 | Find the cause with spark |
| Choppy for one player, fine for the rest | Client lag: low FPS on their PC | TPS or FPS? |
| Rubber-banding for one player, delays on every action | Network: high ping or packet loss | Ping, and why distance sets the floor |
| Everything freezes for a second every few minutes | Garbage collection pauses | Garbage collection pauses |
Step 1: measure TPS
A healthy server runs 20 ticks per second, and each tick has 50 milliseconds to finish everything: mobs, redstone, plugins and chunk loading. On Paper and its forks, type tps in the console. At 20, the server is keeping up and the lag is somewhere else; below that, keep reading.
Step 2: profile while it lags
Guessing which farm or plugin is to blame wastes evenings. spark, a free profiler, records what the server spends its time on and gives you a report that names the code by line. Run it during the lag, not after it. Reading a spark report shows where to look first.
The usual culprits, and their fixes
- Too many entities. Mob farms that never kill, dropped items piling up, minecarts and armour stands. Find the pile and cap it.
- Chunk generation. Players exploring new land make the server generate terrain in the middle of the game. Pre-generate the world up to a border.
- View and simulation distance. They decide how much of the world stays loaded, and the cost grows with the square. Set them sensibly.
- Redstone and hoppers. Clocks that never stop and long hopper chains work every tick. Redstone and hopper lag.
- One heavy plugin. spark names it; then update it, configure it or replace it. Find the plugin eating your CPU.
Will more RAM fix it?
Only if the server is running out of memory: out-of-memory crashes, or a modpack that won't start. With memory to spare and low TPS, more RAM changes nothing, because the bottleneck is time inside the tick. Will more RAM fix lag? explains how to tell, and the RAM guide has the figures by players and mods.
When it's the hardware
If you've cut the entities, pre-generated the world and spark still shows the main thread busy with ordinary work, the processor is the limit. Each world ticks on one main thread, so single-core speed matters more than the number of cores: that's why we run a Ryzen 7 9700X. Paper also has settings worth changing once you know where the time goes: the Paper settings worth changing.
If you remember one thing
Measure before you fix: TPS tells you whether it's the server, spark tells you what in the server. Most lag is entities, chunk generation or one plugin, and more RAM only helps when memory is actually running out.
Questions people ask
Most often: too many entities, chunks being generated while players explore, redstone and hoppers, or one heavy plugin. Check TPS first, then run spark during the lag to see which.
Only if the server is running out of memory. With memory to spare and low TPS, the bottleneck is processor time, so more RAM changes nothing.
20, which is the maximum and the target. The further below it, the more players notice.
If TPS is 20 and only you lag, check your FPS with F3: low FPS is your computer, not the server.
About this article: It comes from what I have learned running EnduranceNodes, and it is published here first. We sell Minecraft hosting, so everything I say about us can be checked on this site, and I point out where we are not the best fit.