MinecraftHub.io
Troubleshooting

Fix the Can't keep up warning on a Minecraft server

What the lag warning measures on a Java server, how to find the slow work with spark, and the fixes that follow from what the profile shows.

Published Checked

Fix it by measuring first with a spark profiler, then cutting the load the profile shows: fewer ticked chunks, pre-generated terrain, enough memory, or different server software. This guide covers Java Edition servers only.

What the Can't keep up warning means

One cycle of the tick loop is a tick. The server normally runs 20 of them per second, so each tick has 50 milliseconds. Milliseconds per tick (MSPT) is the time the server actually spends computing a tick, and TPS can stay at 20 only while MSPT is no higher than 50. Past that, TPS drops and many things take longer, because most actions are timed by tick count rather than real time. The background is in what TPS means in Minecraft.

The tick loop also resets its next tick time when it falls 2 seconds behind the expected time.

Check your server TPS and MSPT

The F3 debug screen shows MSPT as 'ms ticks' and the frame time graph (`F3` + `2`) shows TPS, but both are available only to a multiplayer host or in singleplayer, since the numbers come from the integrated server. On a dedicated server, use spark. It reports TPS to a finer degree through the `/tps` command and tracks tick durations (min, max and average) alongside CPU, memory and disk usage.

Find the cause with a spark profiler

Guessing wastes hours. spark is a profiler for servers, clients and proxies, and its CPU profiler is made for exactly this. It samples activity and builds a call graph, shown in an online viewer. About 30 seconds of running is enough to give useful insight, and it is lightweight enough to run in production. Paper ships spark bundled (its files live in the `spark/` folder). On other software, add the mod yourself.

  • Fabric builds cover 1.17.1 to 26.3.
  • Forge builds cover 1.16.5 to 26.3.
  • NeoForge builds cover 1.20.3 to 26.3.
  • Quilt builds stopped at 1.19.2 (September 2022), so do not plan around spark on Quilt today.
  1. 1.Run `/tps` while the lag is happening to confirm TPS is below 20.
  2. 2.Start a CPU profile and let it run for roughly 30 seconds. You can tune it to specific threads, a sampling interval, or only the laggy periods.
  3. 3.Open the report in the online viewer and follow the tree to the heaviest branches.
  4. 4.If lag arrives in bursts, have spark monitor individual ticks so it reports whenever one tick exceeds a threshold.
  5. 5.If the spikes look like pauses, use its GC monitoring to see how often garbage collection runs and how long it takes.

The command names and options are in the spark docs at spark.lucko.me/docs. The profile tells you which of the next sections to read.

Reduce the chunks the server ticks

Chunks inside the simulation distance are ticked every game tick. They get mob spawning and random ticks, so the simulation distance sets how many chunks the server has to compute each tick. Simulation distance vs render distance explains how that setting differs from render distance. After any change, re-check MSPT.

If the profile points at mobs, check the usual suspects. Large mob counts, hoppers, redstone dust and a raised random tick speed all raise MSPT. The default `/gamerule random_tick_speed` is 3. On Paper, spawn limits sit under `entities.spawning.spawn-limits` in `config/paper-world-defaults.yml`. Override them for one world in that world's `paper-world.yml`, and copy only the value you change.

Pre-generate chunks with Chunky

Chunks that already exist do not need generating when a player arrives. Chunky pre-generates them, and tasks can be paused and continued, with progress saved. It has builds for Bukkit, Paper, Spigot, Folia, Fabric, Forge, NeoForge and Sponge. The Fabric build requires Fabric API. You need to be an operator to run it.

  • `chunky radius 1000` then `chunky start` generates a square centred at 0,0 in the Overworld.
  • `chunky world the_nether`, `chunky shape circle`, `chunky spawn`, `chunky radius 1000`, `chunky start` generates a circle at spawn in the Nether.
  • `chunky worldborder` copies the world border's centre and radius into the selection.
  • `chunky pause`, `chunky continue` and `chunky cancel` manage running tasks.

Give the server the right memory and flags

Paper's documentation recommends at least 6-10GB, however few players there are, while leaving the operating system some memory too. Returns diminish, so 32GB mostly wastes money. It also says to set `-Xms` equal to `-Xmx` and never to set `-Xmx` higher than the machine can support. Too little new-generation space means frequent collections, and the server can fail to keep up with the cost of them. See how much RAM a Minecraft Java server needs for sizing and Aikar's flags for the startup flags. Memory only fixes what spark's GC data blames.

Update or switch server software

Software sets what you can tune. Paper bundles spark and supports per-world configuration in `paper-world-defaults.yml` and `paper-world.yml`, with global settings in `paper-global.yml`. Weigh the options in Folia vs Paper before moving. Back up the world first.

Frequently asked questions

What does 'Can't keep up! Is the server overloaded?' mean?

It means the server is running behind its tick schedule. A tick should finish within 50 milliseconds so the server holds 20 ticks per second. When ticks take longer, TPS falls and many time-based things slow down. Profile the server with spark to see which work is using up the tick budget.

Does giving a server more RAM fix lag?

Only up to a point. Paper's documentation recommends at least 6-10GB however few players there are, and says returns diminish after that. Buying 32GB for a server wastes money with minimal returns. If spark shows the lag comes from chunk generation or mob counts, extra memory changes nothing.

Why does F3 not show my server's TPS?

The F3 'ms ticks' value and the `F3` + `2` frame time graph read the integrated server, so they exist only for a multiplayer host or in singleplayer. On a dedicated server, use spark and the `/tps` command, which reports TPS and tick durations from the server itself.

Do hoppers and redstone cause server lag?

Yes, they are common causes. Hoppers constantly search for items above them, and covering one with a solid block (except bee nests and beehives) stops that check. Redstone dust can cause many block and light updates. A random tick speed set too high also raises MSPT. Confirm with a profile before rebuilding anything.

Resources mentioned.

Related guides.