How to fix Minecraft server lag:
checking TPS, RAM and network
When a Minecraft server lags, check TPS in the console first. If TPS keeps dropping below 19, the server can't keep up, and the usual causes are mobs, redstone, world generation and the CPU. If TPS is fine but someone still lags, the problem is that player's connection or computer.
Figure out which kind of lag it is
| Type | What it looks like | Where the problem is |
|---|---|---|
| Server lag | Everyone lags together, broken blocks come back, mobs teleport and crops grow slowly | The server (low TPS) |
| Network lag | Only some players lag, with delayed actions and rubber-banding | Those players' connection, or they are far from the data center |
| Low FPS | The picture stutters while everyone else on the server is fine | The player's own computer |
Ping is lowest when the data center is close to most of your players. vProxy Cloud has Minecraft servers in Taiwan, Hong Kong and Singapore.
Check TPS with spark
A Minecraft server updates the world 20 times a second, and that rate is called TPS (ticks per second). A steady 20 TPS means the server is keeping up, and if it keeps dropping below 19, the server is lagging. The time each update takes is called MSPT, and once it goes past 50 milliseconds, TPS starts to drop.
- On Paper, typing
tpsin the console shows TPS for the last 1, 5 and 15 minutes. msptshows how long each tick takes.spark healthbuilds a health report. Open the link it prints in the console to see TPS, MSPT, CPU and memory in one place.spark profiler startstarts a profile. Let it run for a few minutes while the server is lagging, then typespark profiler stop. The console prints a link to the report, which shows the plugins, entities and chunks that take the most time.
Recent Paper builds ship with spark built in and start a background profiler when the server boots. Look for [spark] Starting background profiler in the log.
Common causes and fixes
| Cause | How to spot it | Fix |
|---|---|---|
| Too many mobs | Lag is worst near farms and animal pens, and mobs take up a big share of the spark report | Keep farms smaller and clear out piled-up item drops and extra mobs |
| Redstone | Lag around one particular area | Make machines run only when needed and cut back on redstone clocks that never stop |
| World generation | Lag only when players explore new areas | Pre-generate the world with the Chunky plugin, then set a world border |
| View distance too high | CPU usage climbs as more players join | Lower view-distance and simulation-distance |
| Plugins or mods | One plugin or mod takes a lot of time in the spark report | Update, replace or remove that plugin |
| Not enough RAM | The log shows OutOfMemoryError, or the server crashes and restarts on its own | Open a support ticket to upgrade to the plan with the next size up in RAM |
| CPU too slow | No OutOfMemoryError, and mobs, redstone and plugins are under control, but TPS stays low | Move to a CPU with stronger single-core performance |
World updates mostly run on one thread, so when you compare CPUs, the number to look at is the single-core score.
Pre-generate the world
When players keep heading outward, the server has to keep generating new terrain. On a new server, this is the most common cause of lag. Install the Chunky plugin, generate the map ahead of time while few players are on, and then fence it in with a world border.
chunky radius 3000
chunky start
worldborder set 6000This generates a 6000 × 6000 block area centered on 0, 0 and puts the world border around the same area. Generation takes a while. chunky pause pauses it and chunky continue picks it up again. A bigger radius means a bigger world save, so check that your server has the storage space first.
Settings you can change
Both settings are in server.properties and take effect after a restart.
| Setting | Default | What it does |
|---|---|---|
view-distance | 10 | How far players can see. Lowering it cuts down the chunks the server has to send |
simulation-distance | 10 | How far from players mobs, crops and redstone keep running. Lowering it helps TPS the most |
Paper's own config files (in the config folder) can also cap mob counts and set how far apart dropped items merge. Back up the files before you edit them.
Fixing it in the control panel
Watch live usage
The top of the Console shows live CPU, memory, disk and network usage. High memory use alone doesn't mean the plan is too small, because Java holds on to the memory it is given. An OutOfMemoryError in the log, or a server that crashes and restarts on its own, means the plan is too small. If CPU usage stays high, the world has too much to compute, so go back to the spark report and find the plugins, entities or chunks taking the most time.
Restart at the same time every day
In Schedules, create a daily restart from a template. You can also have it post an in-game warning before the restart. Pick a quiet hour such as early morning, so players who see the warning have time to log off.
Upgrade or switch CPUs
If you've dealt with mobs, redstone and plugins and TPS is still low, the CPU can't keep up. To move to a product line with stronger single-core performance, open a support ticket in the client portal first to arrange the move. Upgrading to a plan with more RAM also goes through a support ticket.
References
- Tick Minecraft Wiki
- Command Usage spark docs
- pop4959/Chunky GitHub
- PassMark CPU Benchmarks - Single Thread Performance PassMark Software