Skip to main content

Why is my server lagging?

Rubber-banding, blocks that reappear after you break them, mobs that teleport, and Can't keep up! Is the server overloaded? in the console all mean the same thing: the server thread is falling behind. A Minecraft server has to finish one tick every 50 ms (20 ticks per second). When a tick takes longer, everything waits.

Almost always, the reason is work, not memory and not the machine: one build, mod or plugin doing too much every tick. A pipe network that re-scans itself, a farm with thousands of items, a hopper chain, a quarry, a mob grinder, a mod that writes to disk on the main thread, a view distance the world cannot afford. More RAM does not make any of that faster. A kernel out-of-memory kill is a crash, not lag, and the panel tells you about that separately.

The tick-health banner

FadeHost measures every online server's tick time once a minute. When the slowest minutes have been over 100 ms per tick (that is 10 ticks per second or worse) for ten minutes with players on, the server page shows an amber banner with the number, and the owner gets one alert a day on the channels set under Settings → Alerts (event Slow ticks: the server thread is struggling).

Idle servers never trigger it: an empty world ticks in a millisecond. A server that just started spends its first minute catching up and does not trigger it either. The banner goes away on its own once the ticks have been under 60 ms for fifteen minutes with players on.

Profile it

Guessing is slow. A profile shows exactly where each tick's time goes, and the banner takes one for you:

  1. Press Profile now on the banner while players are on and the lag is happening. It uses spark, the standard Minecraft profiler, through the server's console. Paper and Purpur from 1.21 have it built in; on Fabric, Forge and NeoForge the banner offers to install the spark mod if it is missing (restart the server afterwards, then press the button again).
  2. Within a minute or two a link to spark.lucko.me appears. Open it.
  3. Press flat at the top, then pick Server thread. The list is sorted by how much of the tick each thing takes.

Read the list from the top. The deepest entry with a mod or plugin name in it is your answer:

You seeIt means
com.simibubi.create...PumpBlockEntityCreate pumps re-walking a shared pipe network every tick. Fewer pumps, or split the network.
...tickBlockEntities dominated by one modThat mod's machines, hoppers, drawers or quarries. Fewer of them, or spread them out.
...tickEntity or EntityCrammingToo many mobs or items in one place. Clear the farm, cap the grinder.
ServerChunkManager...executeQueuedTasks or ThreadedAnvilChunkStorage while players fly aroundChunk loading and generation. Lower the view distance, or pre-generate the world.
RegionFile...write every five minutesSync chunk writes on save. Turn on Optimised world saves in the server settings.
Mostly Thread.run ... parkThe server is idle. The lag is on the network or the client side, or nobody was on during the profile. Profile again while it happens.

The profile also shows garbage collection at the top. Frequent long "Old" pauses are the one case where memory is the problem; young pauses of a few milliseconds are normal.

Then

Fix the thing the profile named: remove or shrink the build, remove the mod, lower the view distance, pre-generate the world. Press Profile now again afterwards to see the difference. If the profile names something you do not recognise, send us the link from Support and we will read it with you.