Guessing which plugin causes lag wastes evenings. A profiler answers it in about five minutes, with a report that names the code by line.
Why it happens
A tick has 50 milliseconds to do everything. When something inside it takes longer, TPS drops. A profiler samples what the server is actually executing and tells you which task is consuming the time.
What to do
- Install spark
It works on Paper, Spigot, Purpur, Fabric and Forge. Put the jar in
plugins(ormods) and restart. - Profile while the lag is happening
Run
/spark profiler startin game, let it run for a few minutes of real lag, then/spark profiler stop. Profiling an idle server tells you nothing. - Open the link it gives you
The report is a tree of what consumed tick time, sorted by cost. The top entries are your problem, and they are usually named after a plugin.
- Check memory separately
/spark heapsummaryshows what is filling memory. Useful when the symptom is periodic freezing rather than steady slowness.
You have a plugin or task name and a percentage of tick time next to it. That is the thing to fix, update or remove.
Very high percentages against Minecraft's own internals usually mean entities or chunk loading rather than a plugin. Those have their own articles in this section.