Your server stutters every few minutes. You run /tps and see 18. You have already added RAM, switched to Paper, and optimized your view distance. But the lag persists. The culprit is almost certainly entities — mobs, dropped items, minecarts, armor stands, and the invisible ticking objects that accumulate over hours of play.
Entity lag is different from chunk-generation lag or plugin lag. It creeps up slowly. A fresh world runs fine. A month later, with dozens of mob farms, abandoned minecart lines, and AFK fishing spots, the server struggles to keep up. This guide explains exactly how Minecraft spawns and despawns mobs, why certain setups cause persistent entity buildup, how to diagnose the problem, and which configs to change — without breaking your players' farms.
How Minecraft Spawns and Despawns Mobs
Minecraft's mob spawning system was designed for singleplayer. A lone player explores a cave, and hostile mobs spawn around them. When the player leaves, those mobs despawn. The world stays light.
On a multiplayer server, this system breaks down. Here is why.
The spawn cycle
Every game tick (50 ms), Minecraft checks whether it should attempt mob spawns. The spawn attempt happens once per category (hostile, passive, ambient, water creatures, etc.) per eligible chunk. Only chunks within a player's simulation distance can spawn mobs, and only if the chunk is not already at its mob cap for that category.
The mob cap is calculated per category:
| Category | Vanilla cap (per player) |
|---|---|
| Hostile (monsters) | 70 |
| Passive (animals) | 10 |
| Ambient (bats) | 15 |
| Water creatures | 5 |
| Water ambient | 20 |
| Underground water | 5 |
| Axolotls | 5 |
The key detail: vanilla mob caps are global, not per-player. If one player has 70 zombies loaded around them, nobody else will see zombie spawns anywhere on the server until some of those despawn. This is why large servers feel "empty" after a while — caps fill up and stay filled.
The despawn rules
Mobs do not live forever. Minecraft uses a distance-based despawn system:
-
Instant despawn (128+ blocks): Any mob more than 128 blocks from the nearest player immediately despawns. No delay, no chance — it is gone.
-
Random despawn (32-128 blocks): Mobs between 32 and 128 blocks from the nearest player have a random chance to despawn each tick. The chance increases with distance.
-
Safe zone (under 32 blocks): Mobs within 32 blocks of any player do not randomly despawn.
This system works well in singleplayer. In multiplayer, players spread out across the world, keeping mobs loaded in many chunks simultaneously. Mobs near one player cannot despawn because another player keeps them loaded. Entity counts rise.
Why Mobs Stick Around
Not all mobs follow the despawn rules. Some become "persistent" — they never despawn regardless of distance. Once a mob gains persistence, it stays until killed or unloaded from memory.
The PersistenceRequired flag
The game sets an NBT tag called PersistenceRequired on a mob when any of these happen:
- Item pickup: A zombie picks up a dropped sword. A skeleton picks up an arrow from a dead skeleton. A piglin picks up gold. Any item pickup marks the mob as persistent.
- Name tag: Naming a mob (with an anvil-renamed name tag) makes it persistent. This is intentional — you want your named pet to survive.
- Leash: Mobs attached to a fence post with a lead become persistent.
- Spawned from spawner with persistence: Some custom spawners (from plugins or commands) spawn mobs with the flag already set.
The item pickup mechanic is the silent killer. Picture a dark cave system under your spawn area. Mobs spawn, fight each other, drop items. Other mobs pick those items up. Over days of runtime, dozens of persistent zombies and skeletons accumulate in the caves — each one immune to despawning, each one ticking every game tick.
AFK spots make it worse
When a player AFKs near unlit terrain (for a farm, fishing, or just being away from keyboard), they create the perfect conditions for entity buildup:
- Mobs spawn continuously in nearby caves.
- Some mobs kill others (skeletons shoot each other, mobs fall into water).
- Survivors pick up dropped items.
- Persistent mobs accumulate.
- The mob cap fills with immortal mobs that will never despawn.
A recent discussion in the Minecraft admin community highlighted this exact scenario: a server owner discovered hundreds of persistent hostile mobs underground near long-term AFK spots. Their TPS dropped noticeably, and nobody could figure out why until they ran an entity audit.
Diagnosing Entity Lag
Before changing configs, confirm that entities are actually the problem. Minecraft and Paper provide several tools.
The debug entities command
Running /minecraft:debug entities (requires OP) dumps entity statistics to a CSV file in your server's debug folder. This shows entity counts by type and by chunk. Look for:
- Total entity count (anything over 5,000 on a small server is worth investigating)
- Specific types with unusually high counts (200+ zombies, 100+ skeletons)
- Concentration in specific chunks (the CSV includes chunk coordinates)
Spark profiler
If you run Paper or Purpur, install the Spark plugin. Run /spark profiler start, wait 60 seconds during a lag spike, then /spark profiler stop. The report breaks down tick time by category. Look at the "Entity Tick" section. If entities consume more than 40% of your tick budget, you have an entity problem.
Paper timings
Paper's built-in timings (/timings on, wait, /timings report) provide similar data. The report shows time spent on "Entity Tick — Creature" and "Entity Tick — Hostile". Compare these to other categories.
What to look for
Warning signs in any profiler output:
| Symptom | Likely cause |
|---|---|
| "Entity Tick — Hostile" dominates | Too many hostile mobs in loaded chunks |
| High time on specific mob type | Buildup of that type (often zombies or skeletons) |
| Lag spikes correlate with specific player locations | Entity concentration near that player's chunks |
| Mob cap constantly full but mobs seem sparse | Persistent mobs hiding underground |
Server Config Fixes
Paper and Purpur expose dozens of entity-related configs. The defaults are conservative — they prioritize vanilla behavior over performance. For most servers, you can safely tune these without players noticing.
spawn-limits (paper-world-defaults.yml)
This is the most impactful change. Reduce the per-player mob caps:
spawn-limits:
monsters: 50 # vanilla: 70
animals: 8 # vanilla: 10
water-animals: 3 # vanilla: 5
water-ambient: 10 # vanilla: 20
ambient: 1 # vanilla: 15
Lower caps mean fewer mobs exist at any time, reducing tick load. Players will still see hostile mobs, but caves will feel slightly less dense. For PvE servers where mob combat is not the focus, you can go even lower.
per-player-mob-spawns
Paper defaults this to true, and you should keep it that way. With per-player mob spawns enabled, each player gets their own mob cap calculation. One player with a mob farm does not prevent spawns for everyone else.
despawn-ranges
Adjust how quickly mobs despawn based on distance:
despawn-ranges:
monster:
soft: 28 # start random despawn chance
hard: 96 # instant despawn
creature:
soft: 28
hard: 96
misc:
soft: 28
hard: 64
Reducing the hard range from 128 to 96 blocks makes mobs despawn sooner when players move away. This prevents buildup in areas players passed through.
entity-activation-range
This controls how far from a player an entity must be before the server stops fully ticking it:
entity-activation-range:
monsters: 24 # vanilla: 32
animals: 16 # vanilla: 32
villagers: 32
misc: 8
Entities outside the activation range still exist but run simplified AI (no pathfinding, no target searching). This saves significant tick time on servers with many mobs. The tradeoff: mobs further away seem "frozen" until the player approaches. For most gameplay, this is invisible.
Entity cramming
The vanilla game rule maxEntityCramming defaults to 24. Mobs packed tighter than this take suffocation damage. Set this in server.properties or with /gamerule maxEntityCramming 8 for more aggressive culling. This kills mobs in overcrowded spaces (like farm collection points) faster.
Recommended values by server size
| Config | 10 players | 30 players | 50+ players |
|---|---|---|---|
| spawn-limits.monsters | 50 | 40 | 30 |
| spawn-limits.ambient | 1 | 0 | 0 |
| despawn-ranges.hard | 96 | 80 | 64 |
| entity-activation-range.monsters | 24 | 20 | 16 |
| per-player-mob-spawns | true | true | true |
These are starting points. Monitor your TPS after changes and adjust. The goal is reducing entity load without making the world feel empty.
Player-Side Solutions
Config changes help, but player behavior often matters more. If your players build in ways that accumulate entities, no config will save you.
Light up caves
Persistent mobs accumulate underground because caves are dark and mobs spawn continuously. Encourage players to light the caves under their bases and AFK spots. A fully lit cave system spawns zero mobs, eliminating the accumulation problem at the source.
This is tedious. Players hate it. But it works. Some servers run a nightly announcement reminding AFK farmers to light their caves.
Water-flushing mob farms
Traditional mob grinders let mobs spawn, then push them to a kill chamber. During the push phase, mobs can pick up items from each other, becoming persistent. If the kill mechanism fails or lags, persistent mobs accumulate.
Water-flushing designs move mobs into a kill zone immediately. Mobs have no time to pick up items. No persistent flag gets set. Deaths are fast and clean.
If your players run old-style "drop farm" designs where mobs stack and wait, suggest they upgrade to water-based designs.
Auto-kill over accumulation
"Accumulator" farms store mobs alive until the player wants to kill them (for XP, for looting, for fun). These farms are entity nightmares. Hundreds of mobs sit in a holding pen, each one ticking every game tick.
Auto-kill farms use fall damage, lava, magma blocks, or entity cramming to kill mobs immediately. The only entities are the ones actively spawning — not a stockpile of 500 zombies.
Recommend auto-kill designs in your server rules or documentation. Some servers ban accumulator farms outright.
Clear old entities manually
If persistent mobs have already accumulated, you can remove them with commands. The console commands reference covers entity targeting. A command like:
/kill @e[type=zombie,tag=!player_pet,distance=0..10000]
...removes all zombies not tagged as pets. For a more surgical approach, use Paper's /paper entity command or the Spark profiler to find the chunks with the highest entity counts, then investigate and clear those specifically.
When Entities Are Not the Problem
Not every lag spike comes from entities. Before blaming mobs, rule out:
- Chunk generation: New chunks being explored cause lag. Check with Spark — if "Chunk Load" or "World Generation" dominates, that is your issue. See the performance optimization guide for view-distance tuning.
- Plugin overhead: A poorly written plugin can consume more tick time than all your entities combined. Spark breaks down plugin costs explicitly.
- Insufficient RAM: If your server is garbage-collecting constantly, everything lags. The RAM guide helps you size appropriately.
- Network latency: Players see lag, but TPS is fine. That is a network issue, not a server issue.
Check the basics first. But if your TPS drops over time (fine after restart, worse after hours), entities are almost certainly involved.
Quick Reference
| Setting | Location | Recommended value | Effect |
|---|---|---|---|
| spawn-limits.monsters | paper-world-defaults.yml | 30-50 | Fewer hostile mobs server-wide |
| per-player-mob-spawns | paper-world-defaults.yml | true | Caps calculated per-player |
| despawn-ranges.hard | paper-world-defaults.yml | 64-96 | Mobs despawn sooner when players leave |
| entity-activation-range.monsters | paper-world-defaults.yml | 16-24 | Distant mobs skip AI ticks |
| maxEntityCramming | server.properties | 8-12 | Packed mobs die faster |
| Lighting caves | Player action | Full coverage | Stops spawns at the source |
| Auto-kill farms | Player action | Replace accumulators | No entity stockpiling |
Related Guides
- How to Fix Minecraft Server Lag (The Complete Guide) — the broader lag troubleshooting guide, covering RAM, plugins, and chunk loading alongside entities.
- How to Optimize Server and Website Performance — general performance tuning for Minecraft and other hosted services.
- Minecraft Server Hosting: What RAM Do I Need? — RAM sizing for different server loads, including entity-heavy setups.
- Minecraft Server Console Commands Cheat Sheet — reference for entity targeting, debug commands, and game rules.
- A Complete Tour of the Swelis Control Panel — live resource metrics help you spot entity-related CPU spikes before players complain.
- Backup Strategies for Game Servers and Websites — always back up before changing server configs.
If you want to skip the config tuning entirely, Swelis Hosting runs Paper by default with sensible entity limits pre-configured. But now you know how to tune them yourself.
