How to Reduce Lag on Your Minecraft Server

How to Reduce Lag on Your Minecraft Server
Nothing kills a server faster than lag. Players leave, complaints pile up, and you end up fighting the server instead of building a community. The good news: most lag is fixable. Here's how to diagnose and fix the most common causes.
Understanding Server Lag
First, know what you're dealing with:
- TPS (Ticks Per Second) — A healthy server runs at 20 TPS. Below 18, players start noticing. Below 15, it's painful. Below 10, the server is basically unplayable.
- MSPT (Milliseconds Per Tick) — Each tick should take under 50ms. If it takes longer, TPS drops.
- Network lag (ping) — Separate from server lag. High ping means the player is far from the server, not that the server is slow.
Step 1: Use the Right Server Software
If you're running the vanilla Minecraft server, switch to Paper immediately. Paper includes dozens of performance optimizations that vanilla doesn't have:
- Async chunk loading
- Entity activation ranges (mobs far from players tick less often)
- Optimized explosions, pathfinding, and redstone
- Configurable mob spawning rates
Step 2: Pre-Generate Your World
Chunk generation is the single biggest performance killer. When a player walks into unloaded terrain, the server has to generate it in real-time, which spikes CPU usage hard.
Fix: Use the Chunky plugin to pre-generate a large area before players join.
``` /chunky radius 5000 /chunky start ```
This pre-generates a 5000-block radius around spawn. Let it finish before opening the server. For a world border at 10,000 blocks, this takes 30-60 minutes depending on your hardware.
Step 3: Optimize server.properties
These settings have the biggest impact:
- view-distance=8 — Default is 10. Lowering to 8 significantly reduces chunk loading. Players rarely notice the difference.
- simulation-distance=6 — Controls how far from a player entities and redstone are active. Lower = less work for the server.
- network-compression-threshold=256 — Compresses packets over this size. Default is fine for most servers.
Step 4: Tune Paper's Configuration
Paper gives you fine-grained control. Edit `paper-world-defaults.yml`:
Entity activation ranges (reduce how far away mobs are active): ```yaml entity-activation-range: animals: 16 monsters: 24 raiders: 48 misc: 8 water: 8 ```
Mob spawn limits (fewer mobs = less lag): ```yaml spawn-limits: monsters: 50 animals: 8 water-animals: 3 water-ambient: 3 water-underground-creature: 3 axolotls: 3 ambient: 1 ```
Hopper optimization: ```yaml hopper: disable-move-event: true cooldown-when-full: true ```
Step 5: Limit Redstone and Farms
Players love building massive farms and redstone contraptions, but they're the most common source of lag on survival servers:
- Set entity limits per chunk — Use a plugin like FarmLimiter to cap mob counts in a single area
- Disable hoppers pulling from entities — Hoppers checking for item entities every tick is expensive
- Restrict piston speed — Rapid-fire piston machines can tank TPS
Step 6: Manage Plugins
Plugins cause lag too. Here's how to keep them in check:
- Profile with Spark — Run `/spark profiler` for 5 minutes during peak hours, then check the report to see which plugins are using the most CPU time
- Remove unused plugins — Every plugin adds overhead even if nobody's using its features
- Avoid poorly-coded plugins — If a plugin hasn't been updated in 2+ years or has bug reports about performance, find an alternative
- Don't stack overlapping plugins — Running two anti-cheat plugins or two economy plugins creates conflicts and wasted resources
Step 7: Allocate RAM Properly
More RAM isn't always better:
- 4 GB — Good for 10-20 players with moderate plugins
- 6-8 GB — Good for 20-50 players with many plugins
- 10+ GB — Large networks with multiple worlds
``` java -Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 --add-modules=jdk.incubator.vector -jar paper.jar --nogui ```
These flags are specifically tuned for Minecraft servers and prevent the GC lag spikes that plague servers with default Java settings.
Step 8: Use a World Border
Without a border, players can explore infinitely, generating new chunks forever. Set a world border to keep the world manageable:
``` /worldborder center 0 0 /worldborder set 20000 ```
This creates a 20,000-block diameter world — more than enough for most servers. Pre-generate everything inside the border with Chunky.
Quick Checklist
- Switch to Paper (or Purpur)
- Pre-generate the world with Chunky
- Lower view-distance to 8 and simulation-distance to 6
- Tune entity activation ranges and spawn limits
- Limit hopper and redstone activity
- Profile with Spark to find plugin bottlenecks
- Use Aikar's JVM flags
- Set a world border and pre-generate inside it
Running a lag-free server? Show it off on ServerList.cc and attract players who appreciate smooth gameplay.