Fix Minecraft server lag step by step: measure TPS with spark, lower view and simulation distance, pre-generate chunks, tame entities and check plugins.
Two different kinds of lag
Players say lag for two very different problems, and the fixes differ.
- Server lag: the server cannot keep up. Blocks reappear, mobs stutter and everything feels rubber-banded for everyone. It shows up as TPS below 20.
- Network or client lag: ping is high or one player's game is slow. Other players are fine. A faster server will not fix this: it is about the route between that player and the host, or their own computer.
Measure first
Guessing wastes hours. Install the spark profiler if your server software does not already include it, then use these commands while the lag is happening:
Console or in game (operator)
/tps
/spark healthreport
/spark profiler start
(wait a few minutes while it lags)
/spark profiler stopA TPS of 20 is perfect. Persistently below about 18 means the server is overloaded. The profiler link shows exactly which plugin, world or entity type is using the time.
Fix 1: Lower the distances
Two settings in server.properties control how much of the world the server has to handle for each player. Their defaults are 10, which is generous. Many servers run happily on lower values:
- view-distance: how far players can see. 7 or 8 is a good value for busy servers.
- simulation-distance: how far mobs, crops and redstone are active. 5 or 6 saves a lot of CPU and players barely notice.
Lowering simulation distance first is the cheapest improvement, because the world still looks the same.
Fix 2: Pre-generate the world
Generating new terrain is one of the most expensive things a server does. If players explore, the server generates chunks live while they run. Pre-generate the area you expect people to use with a plugin such as Chunky, then set a world border so nobody wanders past it.
Chunky example (run while the server is quiet)
/chunky radius 4000
/chunky startFix 3: Tame entities and farms
- Count mobs and items. Hundreds of animals in one pen, or thousands of items on the ground from a broken farm, are classic causes.
- Set mob caps and spawn limits in your server's config files, and use the profiler to see which entity type is expensive.
- Ask players to keep animal pens small, and consider an entity-limit plugin for chunk limits.
- Hoppers are costly in large numbers. Reduce long hopper chains and use water streams or minecarts for big sorting systems where it makes sense.
- Redstone clocks left running forever and large mob grinders are worth finding with the profiler.
Fix 4: Check your plugins
If the profiler points at one plugin, check for an update, read its config for expensive options such as very frequent saves, and ask whether you need it. Removing one plugin often does more than any tuning. Be wary of plugins that scan every block or entity on a timer.
Fix 5: Use the right software and Java flags
If you have 5 to 12 GB of heap, community garbage-collector flags such as Aikar's flags are worth using. Take them from the original source for your heap size so they match your setup.
- Run Paper or a Paper-based fork rather than plain vanilla. It includes large performance improvements for chunk loading and entity handling.
- Use a current long-term-support Java version that your Minecraft version requires.
- Give the server a sensible amount of memory, not the maximum. See the RAM guide for how to size it.
If it is still slow
Check the machine itself. Other programs, a busy shared host or a weak CPU can be the bottleneck. Single-core speed matters most for Minecraft. If the profile is flat and the machine is overloaded, upgrading the host is the honest answer.
Frequently asked questions
What is a good TPS for a Minecraft server?
20 is perfect. If TPS stays below about 18, the server is overloaded and players will notice rubber-banding. Check it with /tps.
How do I find what is causing Minecraft server lag?
Run a profiler such as spark: /spark healthreport for an overview or /spark profiler start and stop during the lag. It shows which plugin, world or entity type uses the most time.
What view distance should I use?
Ten is the default. Many busy servers run view-distance 7 or 8 and simulation-distance 5 or 6. Lowering simulation distance first saves the most CPU without changing how the world looks.
Does pre-generating the world reduce lag?
Yes. Generating new chunks live is expensive. Pre-generate the area players will use with a plugin such as Chunky, and set a world border.