1What the numbers say
From our test server's log
[13:07:46 WARN]: Can't keep up! Is the server overloaded? Running 2505ms or 50 ticks behind
Every tick, the server moves mobs, grows crops, runs redstone and answers players, and it has 50 ms for each tick to keep 20 a second. The warning is the server noticing it's behind its schedule: 2505 ms is 50 ticks of 50 ms. It's a warning, not a crash, but players feel the lost ticks as lag.
2What made ours fall behind
On 29 Sep we ran a Paper 1.21.1 server with nobody on, and pushed it three ways:
| What we did | What it logged | TPS over the last minute |
|---|---|---|
| Allowed it one CPU core, and loaded 256 chunks nobody had visited | Running 32910ms or 658 ticks behind | 12.92 |
| Cut its CPU to a twentieth of a core | Running 2505ms or 50 ticks behind, once | 19.2, with one tick taking 700 ms |
| Put 333 villagers in one chunk, on one core | Nothing | 20, with ticks of 6.6 ms |
Generating land was the worst by far: making new chunks is heavy work, and the server waits for the ones it has to load. An empty server needs little CPU, so even a twentieth of a core fell behind only once, and a few hundred villagers were well within one core.
3The fixes, most useful first
- Pre-generate the map around spawn before friends explore, with the Chunky plugin or mod. The server then loads land from disk instead of making it while players wait.
- Give it a faster core. Minecraft runs each world's ticks on one thread, so one fast core beats many slow ones. On a VPS, a plan with dedicated cores stops neighbours taking your CPU time.
- Give it enough memory. A heap that's nearly full makes Java stop to clean up more often, and each stop is time the ticks don't get. The sizing guide gives a size for what you run.
- Keep less of the world running. Lower
simulation-distancein server.properties, the chunks around each player where mobs and crops move. - A single warning at start-up or after a burst of work, with the TPS back at 20, needs nothing.
4Measure it
On Paper and Purpur, two commands show how the server keeps up. Here is ours just after the chunk test:
> tps TPS from last 1m, 5m, 15m: 12.92, 18.02, 19.24 > mspt Server tick times (avg/min/max) from last 5s, 10s, 1m: 0.2/0.1/1.2, 0.1/0.1/1.2, 4.6/0.1/605.2
20 TPS is on time. Tick times under 50 ms leave room; the maximum shows the stalls.
5On a Playkeeper server
- The Overview shows ticks per second for each running server, and says when it's lagging.
- How it's running names what slows the server down, with the fix: players exploring new land, the server using all the CPU it's allowed, a host holding back CPU time, too little memory, a slow disk, or a lot of the world running.
- The World tab pre-generates the map with Chunky, and carries on after a restart.
Questions
Is Can't keep up! Is the server overloaded? bad?
Once, at start-up or after heavy work, it's harmless. Over and over, it means the server can't do 20 ticks a second, and players feel it as lag.
What does 50 ticks behind mean?
A tick is 50 ms, so 50 ticks is 2.5 seconds of the world the server couldn't run on time.
Does more RAM fix Can't keep up?
Only when the server is short on memory. Most often it's the CPU, or players exploring new land: pre-generate the map, and use a fast core.