Newon GoogleMake CraftRank a preferred source in Google SearchAdd on Google ›
BurningLayerDDoS and bot protection for your website and Minecraft server See the plans ›CraftRank SitesA free website and store for your server Make yours ›CommunityAsk questions, share builds and find people to play with Join the forum ›
Servers / Guides / How to reduce lag on a Minecraft server

How to reduce lag on a Minecraft server

Fix server lag step by step: understand TPS and MSPT, profile with spark, tune view and simulation distance, pre-generate the world and control farms.

6 min readUpdated

Lag on a server usually means the server can't keep up with the game, not that the players' internet is slow. The good news is that you can measure exactly what causes it and fix that, instead of guessing.

TPS and MSPT

A Minecraft server runs the game in ticks, 20 times per second. That gives each tick 50 milliseconds. TPS (ticks per second) shows whether the server keeps up: 20 is perfect, and anything lower means everything in the world slows down. MSPT (milliseconds per tick) shows how close you are to the limit: a server at 20 TPS with an MSPT of 45 is about to lag, while one at 15 has plenty of room.

If TPS is a steady 20 but players still feel delay, the problem is their connection or the distance to the server. See ping and latency.

Find the cause with spark

spark is a free profiler plugin and mod. Install it, wait until the server lags, then run:

/spark profiler start
/spark profiler stop

Let it run for a few minutes between the two commands. spark gives you a link to a report that shows which plugins, entities or tasks take the most time. /spark tps and /spark health give a quick overview of TPS, MSPT, CPU and memory.

View and simulation distance

In server.properties, view-distance sets how many chunks players can see, and simulation-distance sets how far around each player mobs, crops and redstone are actually ticked. Lowering the simulation distance saves a lot of CPU while players still see far. Paper also lets you send more chunks to players than are simulated, so a lower simulation distance hardly changes how the world looks.

Pre-generate the world

Generating new chunks is one of the heaviest things a server does, and players exploring with elytra can bring it to its knees. Pre-generate the area inside your world border with the Chunky plugin before you open, for example:

/chunky radius 5000
/chunky start

Then set a world border at the same size so nobody goes beyond it.

Farms, entities and Paper settings

  • Entities are the most common cause of lag: huge animal pens, mob farms and dropped items. Limit animals per chunk and talk to players with oversized farms.
  • Redstone clocks that run all the time add up. Some servers ban them or limit them with a plugin.
  • Paper's config files have many options for entity activation ranges, item merging, despawn ranges, hoppers and chunk loading. Change one thing at a time and measure again with spark.

Memory and startup flags

Give the server enough RAM, but not much more than it needs: very large heaps can make garbage collection pauses longer. Set the minimum and maximum memory to the same value and use a tuned set of Java flags; Aikar's flags are the common recommendation for Paper servers and are explained in Paper's documentation. If you are still short on CPU, a faster processor helps more than anything else, as explained in how to choose hosting.