# The server fell behind and could not keep up

The server's ticks took longer than they should, so the game ran behind real time and players felt lag.

- Code: `server_overloaded`
- Severity: warning
- Category: Performance
- Server types: Every server type
- Page: https://failures.perland.online/failures/server_overloaded/

## Example log

```text
[20:15:44] [Server thread/INFO]: Steve_Builder joined the game
[20:17:02] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2350ms or 47 ticks behind
[20:19:31] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5185ms or 103 ticks behind
```

## Parameters

| Parameter | Meaning |
| --- | --- |
| `ticksBehind` | How many ticks the server was behind when it printed the warning; 20 ticks are one second. |
| `afterPause` | Set to true when the warning came within a minute after itzg's autopause resumed the server, so the pause, not the load, put it behind; absent otherwise. |

## Log lines this page covers

- `Can't keep up! Is the server overloaded? Running`
- `ticks behind`

## What it means

A Minecraft server runs 20 ticks a second, one every 50 milliseconds, and in each tick it moves entities, grows crops, runs redstone and handles players. When ticks take longer than that, the game falls behind real time. Once it is more than about two seconds behind, the server prints `Can't keep up! Is the server overloaded?` with how far behind it is, and skips ahead.

Players feel this as lag: blocks that reappear, mobs that jump, delayed chat. An occasional warning, for example while the world loads at startup, is harmless. Frequent warnings mean the server has more to do than it can manage.

One case is not about load at all. When itzg's autopause has frozen the server while nobody was online, the first tick after the resume seems to have lasted the whole pause, and the server prints this warning once. The issue then carries `afterPause`, and nothing needs fixing.

## Why it happens

- **Too much in the world:** large mob farms, thousands of dropped items, many loaded chunks, heavy redstone clocks.
- **World generation:** players exploring new land, or pre-generation, use a lot of CPU.
- **A plugin or mod that does heavy work on the main thread.**
- **Not enough CPU or memory.** A heap that is nearly full makes the garbage collector run often, which slows every tick.
- **A pause of the Java process,** by autopause or by the host, as described above.

## How to fix

1. If the issue says `afterPause`, there is nothing to fix.
2. Find what takes the tick time with a profiler such as spark (`/spark profiler`), and deal with the plugin, mod or part of the world it names.
3. Lower `view-distance` and `simulation-distance` in `server.properties`.
4. Limit entities: clear dropped items, cap mob farms, and on Paper tune entity and item settings in its configuration files.
5. Pre-generate the world before players explore, at a time nobody plays.
6. Give the server more CPU and memory if it is busy even with these changes.

## In Perland

The issue appears in the server's Diagnosis tab with how many ticks the server was behind, and it is marked as caused by an idle pause when it came right after one, so it does not send you looking for a problem that is not there. The server's issue history shows how often it happens across runs, and the server's resources are where you give it more CPU or memory.

## References

- [spark profiler documentation](https://spark.lucko.me/docs)
- [Minecraft Wiki: server.properties (`simulation-distance`)](https://minecraft.wiki/w/Server.properties#simulation-distance)
- [Paper documentation: configuration](https://docs.papermc.io/paper/reference/configuration)
