Guide Minecraft

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:

text
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.

  1. Wait until the lag happens, for example when players are online.
  2. Type in the console:
text
spark profiler start --timeout 300
  1. 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.

Tip

Cannot make sense of the report? Send the link in a ticket or ask in our Discord.

Step 2: Lower the distances

Two settings in server.properties decide how much of the world the server keeps running:

properties
view-distance=8
simulation-distance=6
  • view-distance is how far players can see.
  • simulation-distance is 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:

text
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?

Did not find what you were looking for?

Open a ticket and our team will look into it with you. For a quick question, Discord works too.

Open a ticket Go to Discord