spark shows you exactly what is making your Minecraft server lag. It measures TPS and MSPT, records a profile of what the server does every tick and puts it in a clear viewer in your browser. Within a few minutes you can see whether it's a plugin, a mob farm or the generation of new chunks. Paper 1.21 and newer have spark built in, so there is nothing to install.
Need a server? With our Minecraft server hosting your server is online within minutes, from €2 per GB a month. You can also try one free for 24 hours.
Mainly want to fix lag with settings such as view-distance, Paper and Chunky? Then read Fix Minecraft server lag first. This guide goes deeper into spark itself: which commands there are and how to read the report.
Before you start
- spark only measures what is happening at that moment. So start a profile while the lag is happening, for example when many players are online.
- Type every command in the console without the
/, or in the game with a/in front. - Operators can use spark by default. Want to give a moderator access without op? Then give the
sparkpermission with LuckPerms:lp user YourName permission set spark true. You can also grant single parts, such asspark.profilerorspark.tps.
1. Check that spark is there
Type spark in the console. If you get a list of commands back, spark is present. That's the case on Paper 1.21 and newer.
Does the console say the command is unknown? Then you're running an older version, Spigot or another server type. Install spark yourself:
- Open your server in the game panel and go to Plugins.
- Search for
spark, click Select version, pick the version for your server type and click Install plugin. - Not listed? Download the Bukkit version from spark.lucko.me/download and upload the .jar file in Files to the
pluginsfolder. See Install plugins. - Restart your server.
On Fabric and NeoForge, spark is a mod: look for it under Mods. On a Velocity proxy you use sparkv instead of spark.
2. Quick checks: tps and health
spark tps
spark health show
spark tpsshows the TPS (ticks per second) over several periods, the MSPT (milliseconds per tick) and CPU usage. A healthy server reaches 20 TPS and stays below 50 MSPT. spark colours the values green, amber or red.- For MSPT you see four numbers: the fastest tick (min), the middle (median), the 95th percentile and the slowest tick (max). A low median with a high max means you have separate lag spikes rather than constant lag.
spark health showprints a health report in the console with TPS, CPU, memory and disk space. If you type justspark health, you get a link to a live dashboard that refreshes every 10 seconds.spark pingshows the average ping of all players, or of one player withspark ping --player PlayerName.
3. Recording a profile
Start a profile while the server is lagging:
spark profiler start --timeout 300
After 300 seconds (5 minutes) spark stops by itself and puts a link in the console. According to its makers, about 30 seconds is often enough, but a few minutes gives a more reliable picture. Other useful variants:
spark profiler startwithout a timeout, and laterspark profiler stopto stop and get the link.spark profiler infoshows whether a profile is running.spark profiler cancelstops without uploading anything.spark profiler openopens the data of the background profiler, which spark runs from startup by default. Handy when the lag has just passed.
Getting the odd spike rather than constant lag? Turn on spark tickmonitor --threshold-tick 50. spark then reports every tick that takes longer than 50 ms. Then record only those slow ticks with spark profiler start --only-ticks-over 100.
4. Reading the report
Open the link in your browser. You first see a list of threads. The most important one is Server thread: that's where the game itself runs.
- Click Server thread to expand it. Every line has a percentage: the share of time the server spent on it. Hover over a line to see the number of milliseconds too.
- Keep following the line with the highest percentage and expand it further. That leads you to the cause.
- Time the server spends sleeping or waiting is good: it means it has time to spare. You can skip those lines.
- Recognise a name? Lines with entity in the name are about mobs and other entities, lines with chunk about loading or generating the world and
CraftSchedulerabout plugin tasks. Some lines have an ⓘ with extra information when you hover over it.
The viewer translates Minecraft's own names (deobfuscation). If that doesn't work automatically, pick the right mappings at the top right.
Useful views, through the eye button at the top:
- Sources: a separate tree per plugin or mod. This is the quickest way to see which plugin costs the most time.
- Flat: the 250 slowest methods as a list. With Bottom Up you see where they are called from.
- Flame Graph: the same data as a graph. The wider the block, the more time it took.
Want to show something to someone else? Hold Alt and click a line to mark it (bookmark), or right-click it and choose Toggle bookmark. The link in your address bar then contains your bookmarks. You can simply share a spark link with a plugin's developer or with our support.
5. Looking at memory
spark heapsummarytakes an overview of what's in memory and uploads it to the viewer. You see how much memory each type of object uses.spark gcshows how often and how long Java cleans up memory (garbage collection).spark gcmonitorreports every collection live.
Long collections that line up with the lag point to a memory problem. Also see Minecraft server crashing or not starting? if you see OutOfMemoryError. spark heapdump writes a full dump as a file on the server. It's big and fills your storage, so only use it when a developer asks for it.
Common problems
- Unknown command: your server doesn't have spark built in. Install it as in step 1 and restart.
- No permission: make yourself operator or give the
sparkpermission, see Before you start. - The report shows nothing special: the profile probably ran when there was no lag. Repeat it at a busy moment. Is the server mostly sleeping but does it still feel slow? Then it's more likely the players' ping or FPS than the server.
- A plugin is at the top: update that plugin, check its settings or remove it for a while and measure again. Add plugins one at a time, so you see right away what makes the difference.
- Mostly entities or chunks: look at the settings in Set up Paper for performance and pregenerate your world with Chunky.