Use spark to find what lags your Minecraft server
Guessing what causes lag wastes hours. A profiler tells you. spark is the standard one for Minecraft servers, and recent Paper versions include it.
TPS and MSPT in one minute
A Minecraft server runs 20 ticks per second. Each tick must finish in 50 milliseconds. Two numbers describe how it is going:
- TPS (ticks per second) should be 20. Lower means the server cannot keep up.
- MSPT (milliseconds per tick) should be well under 50. If it is 40 or more, you are close to trouble even when TPS still shows 20.
Run /spark tps or look at the live numbers in your dashboard.
Run a profile
In the console, run:
spark profiler start --timeout 60
Play as normal for a minute, ideally while the lag is happening. When it ends, spark uploads the report and prints a link. On Saryno, open the Performance tab and press Run a profile: it does the same and gives you a button to open the report.
Read the report
The report is a tree of everything the server spent time on. Open the Server thread, which is where the game runs, and sort by time. You are looking for something that takes far more than its share:
- A plugin name. Spark labels time by plugin, so a plugin using 30 percent of the tick stands out. Update it, change its settings, or replace it.
- Entities. Many mobs or items are the most common cause. Reduce spawn limits, clear dropped items, and avoid huge farms.
- Chunk loading and generation. Exploring new land makes the server generate chunks. Pre-generating the world moves that work to a time you choose.
- Hoppers, redstone and block entities. Large item sorters can be heavy. spark names the world position.
- Garbage collection. If the report shows long collections, the server is short of memory. Add memory or check your Java flags.
Fix one thing and measure again
Change one setting, profile again, and compare. A fix that does not show up in the numbers did not help, however sure you were.
Settings that usually help
- Lower
view-distanceto 8 andsimulation-distanceto 6 inserver.properties. - Lower mob spawn limits in
bukkit.yml. - Remove plugins you do not use.
- Give the server enough memory: see how much RAM a server needs.
The Performance tab on Saryno also reads your live numbers and suggests exactly these, with a button to apply each one. For more, see how to fix Minecraft server lag.