Performance and lag
Read TPS and MSPT, profile with spark, then fix the actual bottleneck.
On this page
My server is laggingTPS and MSPT in plain languageA useful order of checksWhat each resource changesProfile with sparkCommon causes and fixesRAM and garbage collectionView versus simulation distanceWorld generationPerformance mods and pluginsMy server is lagging#
Start with the symptom:
- Blocks/mobs freeze for everyone: check TPS/MSPT and the main server thread.
- One player rubber-bands: check that player’s latency, Wi-Fi and route.
- Exploration causes spikes: watch chunk generation and consider pregeneration.
- Pauses during saves/backups: inspect disk speed, free space and backup timing.
- Started after an update: compare versions and roll back one layer using the backup.
TPS and MSPT in plain language#
Minecraft aims for 20 TPS—twenty game ticks each second. One tick has a 50 ms budget. MSPT is the time the server spends calculating a tick. Below 50 ms usually keeps 20 TPS; sustained values above 50 force the game to slow.
High network ping delays a player’s messages but does not automatically lower TPS. Low TPS affects everyone’s mobs, blocks and redstone. Diagnose the kind of lag before changing settings.
A useful order of checks#
- 1Ask whether every player is affected and whether movement or game logic is slow.
- 2Check TPS/MSPT with a compatible monitoring mod or Crafty metric.
- 3Look at RAM without assuming “100% allocated” means out-of-memory.
- 4Check per-core CPU use and temperature; overall CPU can look low while one core is full.
- 5Watch disk activity and free space.
- 6Remove or roll back newly added mods after a backup.
- 7Reduce
simulation-distance, thenview-distance. - 8Pregenerate a bounded world so exploration is not creating chunks live.
- 9Inspect huge farms, item piles, villagers, chunk loaders and redstone.
- 10Make a backup, then restart normally and compare.
What each resource changes#
CPU single-core speed limits tick work. RAM holds loaded chunks and mod data, but allocating all system memory starves ZimaOS and file cache. SSD speed helps saves, backups and chunk reads. Entity count, farms and redstone increase tick work. Upload and routing affect outside players’ latency.
Profile with spark#
spark ↗ is a profiler available for several Minecraft platforms. It records where server time is actually spent and can produce a shareable report.
- 1On current Paper releases, use the bundled spark profiler. On Fabric, NeoForge, Forge or an older supported platform, install the matching official spark build only if it is not already included.
- 2Reproduce the lag during normal play.
- 3Start a profiler using the command in spark’s current documentation.
- 4Let it capture the problem—not an idle server.
- 5Stop it and open the generated report privately first.
- 6Look for the largest tick-time branches: entities, chunks, a plugin/mod or world task.
- 7Change one cause, then capture the same scenario again.
Profiler links can include server/plugin information. Review before posting publicly.
Common causes and fixes#
| Cause | Evidence | First measured change |
|---|---|---|
| Live chunk generation | Spikes when players explore | Pregenerate a bounded area |
| Too many active chunks | MSPT rises with spread-out players | Lower simulation distance |
| Entity-heavy farms | Entity ticking dominates profile | Limit or redesign the specific farm |
| Redstone | Block/entity tick branch is high | Inspect active contraptions |
| Plugin/mod task | Named code dominates profile | Update, configure or remove that component |
| Slow storage | Saves/backups stall; high disk wait | Move active world to SSD and reschedule backups |
| Thermal throttling | CPU clock drops under load | Clean cooling and check temperature |
| Memory pressure | OS swaps or process is killed | Reduce heap/workload or add system RAM |
RAM and garbage collection#
Allocate enough for the workload but leave headroom for the OS, Crafty, containers and file cache. A huge heap can make garbage collection less frequent but longer and can encourage plugins/mods to retain more data. “Free RAM” inside Java is not automatically wasted.
View versus simulation distance#
View distance controls how far chunks are sent/kept for viewing. Simulation distance controls how far game logic remains active. Lower simulation distance often reduces tick work more directly. Change in small steps and tell players.
World generation#
Generating terrain is CPU and storage intensive. Pregeneration moves much of that work to a planned window and creates a known storage footprint. Set a world border first; an unlimited pregen is not a plan.
Performance mods and plugins#
Paper already includes many optimizations. Fabric offers projects such as Lithium, FerriteCore, Krypton, ServerCore and Alternate Current, but compatibility varies by exact Minecraft release and with each other. Verify official project metadata and change a few at a time.
Avoid automatic “lag clear” tools that regularly delete entities without identifying the cause. They can hide symptoms and surprise players.