spark: How to Find What's Causing Lag on Your Minecraft Server
Removing plugins blindly or adding RAM “just in case” usually fixes nothing. spark measures where the server's time goes and names the culprit: a plugin, a mod, a farm or world generation. On Paper it's already built in.
What spark is and where to find it
spark is a profiler: it looks many times per second at what the server is doing and adds it up. At the end you get a tree with the percentage of time each thing takes, like the Windows Task Manager, but inside Minecraft.
On Paper it's included since 1.21: it's the official profiler and replaces the old “timings”, which Paper switched off. There's nothing to install; the commands start with /spark and require admin (op).
On Fabric, Forge or NeoForge it's a mod you install only on the server (players don't need it). It's on Modrinth under the name spark.
Rather not set it up yourself? Minecraft servers from €6 a month, no contract and a full refund within 72 hours. Or create a free Minecraft server, no card needed.
First, the pulse: /spark tps
It shows TPS (ticks per second) for the last minute, the last 5 and the last 15, and MSPT: the milliseconds each tick takes. Minecraft wants 20 ticks per second, so each tick has 50 ms. With MSPT below 50, the server has headroom even though TPS says 20; above 50, TPS starts to drop and you notice it.
If TPS is at 20 and someone still stutters, the problem isn't the server but that player's connection or computer (the lag guide explains it).
/spark health gives a fuller snapshot: TPS, MSPT, memory used, CPU and disk usage. It's the first thing worth pasting if you ask someone for help.
Find the culprit: the profiler
Wait until there's lag
Profiling an empty server is pointless. Do it when the lag is noticeable: with people online, while exploring or when the farms are loaded.
Start it with a fixed duration
/spark profiler start --timeout 300 leaves it measuring for 5 minutes and it stops on its own. With less than a couple of minutes the report comes out too noisy.
Open the link
When it finishes, spark uploads the report and gives you a link to its web viewer. There's nothing to download; you can pass the link to whoever is helping you.
If the lag comes in spikes
For one-second freezes that come and go, it's better to use /spark profiler start --only-ticks-over 100 --timeout 300: that way it only records ticks that took longer than 100 ms, and the culprit doesn't get diluted among the good ticks.
How to read the report without being a programmer
At the top there's a tree starting at “Server thread”, the main thread where the whole game happens. Keep expanding the branch with the highest percentage, without stopping at the small ones.
If, as you go down, the name of a plugin or mod appears (spark marks it on the right of each line) with a large percentage, you have a suspect. Plugins normally take very little; one that takes 20 or 30 % of the tick has a problem or a configuration that asks too much.
If what weighs most has “entity” or “chunk” in its name, it's the world: too many animals, items on the ground, villagers or hoppers. If chunk generation is heavy, you're exploring new areas.
And if nothing stands out but the report shows a lot of time in “GC” (Java's garbage collector), memory is tight: the server spends its time cleaning it up.
What to do with what you find
A plugin or a mod: check whether there's a newer version, review its configuration (many have tasks every few ticks that can be spaced out) or replace it with another that does the same job. Make a backup before removing anything.
Entities: limit the size of farms, clear up loose items and don't cram villagers together. Lowering “simulation-distance” in server.properties reduces what's simulated around each player and usually makes a big difference.
World generation: pregenerate the world with Chunky and set a border with /worldborder. Once an area has been explored, it no longer costs anything.
Memory: if GC pauses are long and frequent, the server needs more RAM or fewer mods. That's the case where more RAM does fix the lag.
On NapNodes
Minecraft servers come on Paper with the latest version, so spark is already there: open the server's “Console” in the panel and type spark tps (in the console, without the slash). On “Home”, the server screen, you see how much memory and CPU it's using at the same time, and under “Advanced settings” → “Performance”, its graphs.
Your plan's RAM is yours alone, with no overselling: if spark says the lag is your world or your plugins, you fix it on your server; it doesn't depend on what other customers do on the same machine. And if it turns out you're short of memory, you give it more without reinstalling anything or losing the world: “More RAM” in “My plan & invoices” or “Buy RAM” in “My servers” (the guide to giving it more RAM explains it).
On Fabric, Forge or NeoForge, search for it in the panel's “Mods & plugins” and it installs in one click.
Frequently asked questions
How do I find which plugin is causing lag on my Minecraft server?
With spark: /spark profiler start --timeout 300 while there's lag, and in the report always expand the branch with the highest percentage. Next to each line it says which plugin or mod it belongs to.
Do you have to install spark on Paper?
No. Paper has included it since 1.21 as the official profiler. On Fabric, Forge or NeoForge you do: it's a mod that goes only on the server.
What is MSPT?
The milliseconds the server takes for each tick. To keep 20 TPS each tick has 50 ms: below 50 it runs fine; above it, the server falls behind and you notice the lag.
Do Paper timings still exist?
Paper switched them off in 1.21 and recommends spark instead. If an old guide tells you to use /timings, use /spark profiler.
Shall we set it up for you?
Minecraft servers from €6 a month, never oversold: your RAM is yours alone. And if you'd rather start without paying, there's a free Minecraft server, no card needed.
Your server doesn't show up in the game? Check it in a second with “Is my Minecraft server online?”: players, version and MOTD, free. Need a player's UUID for the whitelist or permissions? Look it up here. Handing out enchanted items? Build the command with the /give generator.
Free tool: World border generator. Radius or side, centre, Nether and End, and a shrinking border for UHC: the /worldborder commands for your version.
Keep reading
- Why Your Minecraft Server Is Lagging and How to Fix It
Server lag or connection lag, memory, world generation, farms and heavy mods: how to tell what's going on and what to do in each case.
- Optimize a Minecraft Paper Server: The Settings That Really Reduce Lag
What to change in server.properties, bukkit.yml, spigot.yml and paper-world-defaults.yml to raise your Minecraft server's TPS, and what to leave alone.
- WorldEdit on Your Minecraft Server: How to Install It and the Most Used Commands
Install WorldEdit on your Minecraft server and learn to select with the axe, //set, //replace, //copy, //paste, //undo, schematics and permissions.