How to fix Minecraft server lag
"The server's lagging" can mean a few different things, and each one has a different fix. This guide helps you work out which kind of lag you have, find what's causing it and fix it, starting with the free changes before you spend money on a bigger plan.
Server lag vs. ping vs. FPS
Before you change anything, figure out which problem you actually have.
- Server lag (low TPS). The server can't keep up. Minecraft aims for 20 ticks per second (TPS). When the server falls behind, everyone notices at the same time: mobs freeze or teleport, blocks reappear after you break them, crops and furnaces slow down.
- High ping (network lag). The server is fine, but your connection to it is slow. It usually affects some players more than others. Hits land late and you rubber-band when you move. Our servers are in Amsterdam, so you can check your connection with our ping test.
- Low FPS (client lag). Your own computer is struggling to draw the game. Everything looks choppy, but the world itself behaves normally. Lower your render distance, shaders or graphics settings. A bigger server won't help here.
A quick test: if everyone lags at the same moment, it's probably the server. If only one person lags, it's probably their connection or their computer.
To check TPS, Paper and Purpur servers have a tps command in the console. The spark profiler (below) also shows it.
Read CPU and RAM in the panel
The Pterodactyl panel shows your server's CPU and memory use. Watch them while the lag is happening.
CPU. On our plans, CPU is a percentage: 100% is one thread of our AMD Ryzen 9 9950X, and a plan with 200% can use up to two threads at once. Minecraft's main game loop only ever uses about one thread. The extra percentage on bigger plans goes to things around it, like generating chunks, plugins, mods, saving the world and Java's memory clean-up. If CPU sits at your plan's limit for long stretches, the server is out of CPU. The hardware page explains this in more detail.
RAM. Java always holds on to memory, so a high number on its own isn't a problem. Watch for memory that stays pinned at your limit, frequent stutters every few seconds (Java's garbage collection struggling), or crashes with OutOfMemoryError. Those mean the server needs more room, or something is using more than it should.
More RAM doesn't fix CPU problems, and giving Java more memory than it needs can even make garbage collection pauses longer. Size your plan sensibly, and use the RAM calculator as a guide.
Find the cause with spark
Guessing wastes time. spark is a free profiler that shows exactly what your server spends its time on. It's built into recent Paper versions, and it's available as a plugin or mod for other server types, including Fabric, Forge and NeoForge.
- Wait until the server is lagging, or until people are online and playing normally.
- Run
spark profiler startin the console. - Let it run for a few minutes.
- Run
spark profiler stop. spark gives you a link to a report.
In the report, look at what's taking up the most time on the main server thread. You'll often see a specific mod, plugin, entity type or chunk area. spark tps and spark health give a quick overview too.
Lower view and simulation distance
These two settings in server.properties have a big effect on performance:
- view-distance is how many chunks around each player the server sends to them.
- simulation-distance is how many chunks around each player are actually ticking: mobs move, crops grow, redstone runs.
Both default to 10. Every step up adds a ring of chunks around every player, so the cost grows quickly as more people spread out across the world. Lowering simulation distance is usually the bigger win, because ticking chunks costs much more than just sending them. You can often keep view distance a bit higher so the world still looks good, while bringing simulation distance down.
Paper and Purpur have more settings in their config files, including entity and item limits, that can help further. Change one thing at a time and check the result.
Restart the server after editing server.properties.
Pre-generate the world
Generating new chunks is one of the heaviest things a server does. When players explore with elytra or boats, the server has to create terrain on the fly, and everyone else feels it.
Pre-generating creates the world ahead of time, so the server only has to load chunks that already exist. The usual tool is Chunky, available as a plugin for Paper and as a mod for Fabric, Forge and NeoForge.
- Install Chunky and restart the server.
- Set a world border so players stay inside the area you generate. Chunky can match its area to your border.
- In the console, set the center and radius (for example,
chunky center 0 0andchunky radiusfollowed by the radius in blocks you want). - Run
chunky start, andchunky pauseif you need to stop it.
Do this when few people are online, since it uses a lot of CPU while it runs. Bigger areas take longer and use more storage, so only generate as much as your players will realistically use. Make a backup first.
Find heavy mods and farms
Often the cause is one specific thing. spark usually points straight at it. Common culprits:
- Big mob farms and entity piles. Hundreds of mobs or dropped items in one place are expensive. Add kill chambers, hoppers or collection limits.
- Busy redstone and hopper chains. Clocks that never stop and long hopper lines tick constantly. Switch them off when they're not in use.
- Villager trading halls. Large numbers of villagers with complex pathfinding add up.
- Heavy mods. Some mods, like big automation or world-generation mods, cost more than others. If spark points at one, check its config for performance options, or update it.
- Outdated plugins or mods. Updates often include performance fixes.
Ask the owners of big farms to build sensibly. A friendly limit is easier than a laggy server.
Java startup flags, like the garbage collection settings in Aikar's well-known flags, aren't something you can edit yourself on our servers. If you think yours need a look, ask us in a Discord ticket and we can review them.
When to move to a bigger plan
Move up when you've done the free fixes and the panel still shows the server running out of resources:
- CPU sits at your plan's limit while people are playing, even after lowering simulation distance and dealing with farms.
- Memory is always at its limit, or the server crashes with out-of-memory errors.
- You've added a much bigger modpack, more plugins, or your community has grown.
A bigger plan gives you more RAM and more CPU threads. It won't fix high ping or low FPS, and it won't fix one badly built farm, so use spark to rule those out first. When you're ready, ask us in a Discord ticket to move to a bigger plan.
Still stuck? Open a ticket in our Discord or email [email protected] with your spark report link, and we'll take a look as soon as we can.
Next steps
Before big changes like pre-generating or updating mods, make a backup: see backups and schedules. If you've outgrown your server, compare the plans.