Performance & Optimization
There are two kinds of lag:
| Kind | What players see | Cause |
|---|---|---|
| Server lag (low TPS) | Blocks reappear after breaking, mobs freeze then jump, crops and furnaces slow down. Everyone has it. | The server can't finish its 20 ticks a second. |
| Connection lag (ping) | Rubber-banding for one player, high ping in the tab list. Others are fine. | That player's internet, Wi-Fi or distance. |
This guide is about server lag.
Measure it
In the console:
- Paper/Purpur:
tps→ three numbers (1, 5 and 15 minutes). 20 is perfect, 18+ is fine, under 15 players notice. - Any server with spark:
spark tpsalso shows MSPT (milliseconds per tick). Under 50 ms keeps 20 TPS. - Memory:
spark healthor the Console's Memory box.
Find the cause with spark
spark is built into Paper and Purpur; on Fabric, install the spark mod.
- While the lag is happening, run
spark profiler start. - Wait 2–5 minutes.
- Run
spark profiler stop. spark prints a link (https://spark.lucko.me/…). - Open the link. Expand Server thread and follow the biggest percentages down. It usually ends at a specific plugin, mod, entity type or block (e.g. hoppers, villagers, a farm).
You can share the link in our Support room. It contains no passwords.
Common causes and fixes
| Cause | Fix |
|---|---|
| Players exploring new land | Pre-generate and set a world border. |
| Too many entities (mob farms, item piles, villager halls) | spark → Entities shows counts. Limit farm sizes; on Paper, tune entity-per-chunk-save-limit and max-entity-collisions in config/paper-world-defaults.yml. |
| Simulation distance too high | Lower simulation-distance to 5 or 6 (settings). |
| Hoppers and redstone clocks | Replace hopper chains with fewer hoppers or water streams; switch off clocks when not in use. |
| A heavy plugin or mod | spark names it. Update it, configure it, or replace it. |
| Garbage-collection pauses (lag spikes every few seconds or minutes) | Memory is too tight. Remove heavy mods, or upgrade your plan. See best practices. |
| Running out of memory | OutOfMemoryError in the log, or memory pinned at the limit. Fewer mods/plugins or a bigger plan. |
Use a faster server type
- Paper or Purpur instead of vanilla/Spigot: much faster, same gameplay.
- On Fabric, add server-side optimisation mods: Lithium, FerriteCore, ScalableLux. Use C2ME releases or betas, not alphas.
What not to do
- Don't install "lag-clearing" plugins that delete dropped items or kill mobs on a timer. They annoy players and hide the cause.
- Don't set
max-tick-time=-1to "stop crashes". It hides a frozen server. - Don't add more memory than the server needs. Past what it uses, more memory doesn't make it faster, and on Java it can make pauses longer.
