How do I reduce lag on my Minecraft server?
How to find the cause of lag on your Minecraft server with spark, and make the server lighter with view-distance, pre-generation and fewer entities.
By Hermie Updated
Lag on a Minecraft server almost always comes from too much work per tick: too many chunks, entities, redstone, or a heavy plugin or mod. With spark you can see what keeps your server busy, and a few settings make it lighter.
Is it the server or your connection?
Type in the console:
tps
This works on Paper and Purpur. TPS (ticks per second) should be 20.
- TPS around 20, still lag: it is usually the player's connection or PC, not the server.
- TPS clearly below 20: the server cannot keep up. Continue with the steps below.
Step 1: Find the cause with spark
Paper and Purpur include spark since Minecraft 1.21. On Fabric, Forge or an older version, install spark as a plugin or mod.
- Wait until the lag happens, for example when players are online.
- Type in the console:
spark profiler start --timeout 300
- After 5 minutes you get a link to a report. Open it and click through the top lines. They show which plugin, mod or type of entity takes the most time.
Step 2: Lower the distances
Two settings in server.properties decide how much of the world the server keeps running:
view-distance=8
simulation-distance=6
view-distanceis how far players can see.simulation-distanceis how far away mobs, crops and redstone keep working.
Both default to 10. Lower means less work for the server. Stop your server, change the values in Files and start again.
Step 3: Pre-generate the world
Creating new chunks is expensive. With the Chunky plugin you generate the world in advance, for example within a radius of 3000 blocks:
chunky radius 3000
chunky start
Do this when few players are online.
Step 4: Limit entities and farms
- Large groups of animals, villagers or items on the ground are expensive. Split farms up or make them smaller.
- Clear loose items with
kill @e[type=item]. - On Paper you can set entity limits per chunk in
config/paper-world-defaults.yml. See the Paper documentation.
Step 5: Use Paper or performance mods
- If you run Vanilla or Spigot, Paper is usually faster with the same world.
- On Fabric, mods like Lithium and FerriteCore help.
Still lagging?
If Memory in the console keeps hitting the maximum, or TPS stays low after these steps, your server needs more room. Look at the Minecraft plans or open a ticket with the link to your spark report.
Did this article help you?
Related articles
How do I change the Java version of my Minecraft server?
Every Minecraft version needs its own Java version. This is how you choose the right Java version for your Minecraft server in the game panel.
How do I change the version of my Minecraft server?
How to move your Minecraft server to a different version: download the jar from our mirror, replace server.jar and choose the right Java version.
How do I install mods on my Minecraft server?
How to install mods on your Minecraft server with Fabric: place the server launcher, add Fabric API and upload your mods to the mods folder.
Why does my Minecraft server crash?
Does your Minecraft server crash or not start? Find the error and fix the most common causes, from the Java version to plugins and memory.