How to use spark to find what is causing lag
Profile your Minecraft server with spark: start and stop the profiler, catch lag spikes, read the results and check TPS, MSPT and memory.
Updated · 2 min read
spark is a profiler that shows exactly which plugins, mods, entities or game systems are using your server's tick time. Run it while the server is lagging, open the link it gives you, and look for the biggest share of time.
Getting spark
- Paper: recent Paper versions include spark built in. Run
/sparkto check. If the command is unknown, download the spark plugin from Modrinth or its website and put it inplugins. - Forge: download the Forge build of spark for your Minecraft version and put it in
mods.
Commands work from the console (without the slash) or in game for operators.
Quick health check
/spark tps
/spark health
/spark tps shows TPS and MSPT over several time windows. /spark health adds CPU usage, memory and disk. Use them to confirm the server is actually lagging before profiling. See TPS and MSPT explained.
Profile constant lag
- Wait until the server is lagging, with players online if that is when it happens.
- Start the profiler:
/spark profiler start
- Let it run for at least 30 seconds, ideally a few minutes.
- Stop it:
/spark profiler stop
spark uploads the results and prints a link to its web viewer.
You can also set a fixed duration so you do not need to stop it yourself:
/spark profiler start --timeout 120
Profile lag spikes only
If the server is fine most of the time but freezes now and then, record only the slow ticks:
/spark profiler start --only-ticks-over 100
This records only ticks that took longer than 100 ms, so the spikes are not drowned out by normal ticks. Leave it running until a few spikes have happened, then stop it.
Reading the results
The viewer shows a tree of where time was spent on the server thread.
- Expand the Server thread entry. Ignore other threads at first; they rarely cause TPS lag.
- Keep expanding the branches with the highest percentages.
- Look for recognizable names:
| You see | Usually means |
|---|---|
A plugin's package name (for example com.example.someplugin) | That plugin is heavy. Update, configure or replace it. |
tickEntities, entity class names | Too many mobs or items. Find farms or item piles. |
ChunkGenerator, generate, worldgen | Players exploring new chunks. Pre-generate the world. |
Hopper, tickBlockEntities | Hopper chains or many block entities. |
Redstone, neighborChanged | Large redstone builds or clocks. |
GC or long pauses in memory graphs | Garbage collection problems. See memory article. |
The percentages are a share of the time recorded, so focus on the largest branches first.
Memory tools
/spark heapsummary
/spark gc
heapsummary shows what is filling memory, and gc shows garbage collection statistics. These help when the server slowly gets laggier until a restart.
Sharing results
The viewer link is public to anyone who has it. You can paste it in the Schokr Discord when asking for help, which is much more useful than a description of the lag.