Skip to main content
⚔️ Valheim 1.0 is out. 25% off:DOOM25

Minecraft lag, explained

Spark Analyzer

Paste a spark profiler link. We read the report and tell you what is slowing your server down, in order, with the exact setting or file to change.

Example reportNo link yet? Run /spark profiler start --timeout 300 while the lag is happening. spark posts the link in chat after 5 minutes.
Struggling

Your server runs at 58% speed. The biggest cost is 1,621 cow entities in 8 chunks.

Every tick takes 84 ms on average, and Minecraft only has 50 ms. Start with the first fixes below.

AdvancedSlimePaper 26.2Java 25Players: 2357 pluginsProfiled 4 min 29 s
TPS, last 5 min11.5 / 20
020 is full speed
Tick time (MSPT)84 ms median
50 ms budgetp95 120 ms, max 379 ms
Memory (heap)3.3 of 5 GB used
GC pauses 13 ms avgevery 22 min
Entities loaded4,348
Cow 1,826all other types

What to fix, in order

1 critical2 high4 medium
Critical

1,621 cow entities packed into 8 chunks

Every entity is moved and collision-checked each tick, and packed together they collide with each other constantly. A pile-up like this is one of the most common causes of lag.

chunk -4, -4: 334 cowchunk -4, -3: 332 cowchunk -4, -2: 319 cow+5 chunks
How to fix
  1. Go to chunk -4, -4 (block X -64, Z -64) in world ff7b7ff4… and cull the entities there.
  2. Cap the farm so it can't grow back: a breeding limit, a kill chamber, or a plugin or mod that limits mobs per chunk.
High

511 dropped items on the ground

Every item on the ground ticks and tries to merge with its neighbours. Farms that overflow into the world are the usual source.

item 511
How to fix
  1. Find the overflowing farms or item streams and give them storage, or a hopper into lava.
  2. Use merge-radius and Paper's alt-item-despawn-rate instead of an item clearing plugin.
High

ProtocolLib uses 20.9% of every tick

One plugin or mod taking this much of the main thread is the first thing to look at. Often it is a setting in that plugin, or another plugin calling it.

ProtocolLib20.9% of Server thread56.2 s / 4.5 min
How to fix
  1. Update ProtocolLib to its latest release build.
  2. Open the report in the spark viewer, expand ProtocolLib, and check what calls it and which of its tasks is slow.
Medium

325 villagers tick even when nobody is near

Villagers are among the most expensive mobs, and spigot.yml keeps inactive villagers ticking outside the activation range.

tick-inactive-villagers: truevillager 325iron_golem 186
How to fix
  1. Set tick-inactive-villagers to false. Trading halls and iron farms near players keep working.
# spigot.yml
world-settings:
  default:
    entity-activation-range:
      tick-inactive-villagers: false   # was true
Medium

Hopper and redstone settings

Hoppers check for items many times per second, and hopper minecarts check every tick. The Paper settings below skip work that changes nothing.

ignore-occluding-blocks: falsehopper_minecart 99tile entities 47972
How to fix
  1. Apply the values below and restart.
  2. Very technical redstone can behave slightly differently. Test your key contraptions.
# config/paper-world-defaults.yml
hopper:
  ignore-occluding-blocks: true   # was false
Medium

Paper world settings to tune: 1

These values in paper-world-defaults.yml cost tick time on a busy server. The values below follow YouHaveTrouble's optimization guide.

max-auto-save-chunks-per-tick: 24
How to fix
  1. Apply the values below in config/paper-world-defaults.yml.
  2. Restart the server so the change applies.
# config/paper-world-defaults.yml
chunks:
  max-auto-save-chunks-per-tick: 8   # was 24
Medium

Plugins that cause more lag than they fix

Item clearers and mob stackers scan the world over and over, and stacked mobs make the server spawn more. Plugin managers that reload plugins at runtime leak memory.

PlugManX 3.1.0-Beta.2
How to fix
  1. Remove PlugMan and restart the server instead of reloading plugins.

Where the tick time goes

Share of the main server thread

Minecraft itself entities, chunks, redstone
73.8%
ProtocolLib
20.9%
entity-limiter
3.6%
WorldGuard
1%
Intave
0.5%
16 other plugins
0.2%

Measured the same way as spark's own Sources view.

Top entities

All worlds

  • Cow1,826
  • Dropped item511
  • Villager325
  • Item frame285
  • Iron golem186
  • Skeleton147
  • Armor stand110
  • Sheep110

Already set up well

5 checks passed

  • view-distance 7 simulation-distance 4
  • -Xms equals -Xmx 5 GB
  • Aikar's flags with G1GC
  • Memory headroom 35% of the heap free
  • No ClearLag or other item clearing plugins

How to make a spark report

spark is free and runs on Paper, Spigot, Purpur, Fabric, Forge and NeoForge.

  1. Install spark

    Paper 1.21 and newer ship spark built in. On other platforms, drop the spark jar in plugins / mods and restart.

  2. Profile during the lag

    Run /spark profiler start --timeout 300 when players notice lag, not on an empty server.

  3. Paste the link here

    After 5 minutes spark prints a spark.lucko.me link. Paste it above and press Analyze.

Frequently asked questions Find answers to common questions about our server hosting.

Any more questions?