How to Fix Minecraft Server Lag & Keep 20 TPS (2026 Guide)
Nothing ruins a player's immersion faster than severe block-lag, rubberbanding, delayed chunk loading, and chat latency. If your Minecraft server's TPS (Ticks Per Second) drops below 20, players will notice immediate delays in combat registration, entity movement, and block breaking.
Maintaining a stable, rock-solid 20 TPS is the number one priority for any successful server administrator. This comprehensive guide covers deep technical strategies, Java garbage collection optimization flags, profiling tools, and automated solutions to keep your server running at maximum performance.
Understanding Ticks and Server Performance
To fix lag, you must first understand how Minecraft processes time. The server operates on a strict loop of 20 ticks per second (one tick every 50 milliseconds).
Every single operation in the game world—including redstone wire updates, mob pathfinding, physics calculations, plugin event handlers, and player movement—must execute entirely within that 50ms window.
[50 Millisecond Tick Window]
├── World Physics & Gravity (10ms)
├── Mob AI & Pathfinding (15ms)
├── Redstone & Tile Entities (10ms)
└── Plugin Executions & Network (10ms)
When heavy calculations exceed this 50ms threshold, the server "skips" or delays the next tick, causing TPS to drop. Common culprits include unoptimized mob farms, memory fragmentation, and poor Java startup parameters.
Step 1: Optimize Java Startup Flags (Aikar's Flags)
One of the biggest mistakes administrators make is allocating massive amounts of RAM (e.g., 16GB+) to their server startup scripts without proper Garbage Collection (GC) configurations. Unoptimized GC causes massive "Stop-The-World" pauses where the entire server freezes for seconds at a time.
Modern high-performance servers utilize Aikar's G1GC Flags to manage memory efficiently. Use this production-ready startup script for Java 17 and Java 21:
java -Xms10G -Xmx10G \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=20 \
-XX:+UnlockDiagnosticVMOptions \
-XX:+G1SummarizeRSetStats \
-XX:G1ReservePercent=20 \
-XX:InitiatingHeapOccupancyPercent=15 \
-XX:G1HeapRegionSize=32M \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=4 \
-XX:G1GCLiveThresholdPercent=90 \
-XX:RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 \
-XX:+PerfDisableSharedMem \
-XX:MaxTenuringThreshold=1 \
-jar server.jar nogui
Step 2: Automate Server Restarts & Cache Clearing
Even with optimized garbage collection, continuous operation over days leads to minor memory fragmentation and cache accumulation, especially on active multiplayer networks.
The cleanest way to maintain peak performance without manual staff intervention is scheduling automated reboots during low-traffic hours (e.g., early morning).
Instead of writing fragile custom shell scripts, you can deploy the automated TimeRestart Plugin from the Devlio marketplace, which handles broadcast warnings, safe world saving, and clean shutdowns automatically.
Step 3: Profiling and Identifying Performance Bottlenecks
When lag spikes occur, guessing the cause is a waste of time. You need concrete data from profiling tools:
-
Spark Profiler: A modern, incredibly lightweight performance profiler plugin. Run
/spark tpsor generate a full CPU usage report using/spark profiler. It provides a web-based breakdown showing exactly which plugins or entities are draining CPU cycles. -
Timings Reports: Use paper/spigot's built-in command
/timings pasteto upload a detailed tick-rate report. Look for red spikes indicating tile entities (hoppers, spawners) consuming excessive tick time.
Troubleshooting Quick Reference Table
| Performance Symptom | Probable Root Cause | Recommended Technical Solution |
|---|---|---|
| TPS drops during peak player hours | Entity accumulation / Hopper spam | Install entity stackers and optimize hopper ticking rates. |
| Random 2-second freezing spikes | Java Garbage Collection pauses | Implement Aikar's G1GC flags shown in Step 1. |
| Gradual memory bloat over 48 hours | Plugin memory leaks | Implement scheduled reboots using the TimeRestart Plugin. |
| Slow chunk loading / Teleport lag | Disk I/O bottlenecks | Pre-generate your world borders and use high-speed NVMe SSDs. |
Frequently Asked Questions (FAQ)
Q: How much RAM should I allocate to my Minecraft server?
A: For most medium-sized survival servers, 8GB to 10GB of dedicated RAM running Aikar's flags is the sweet spot. Giving a server 16GB+ without extreme player loads can actually hurt garbage collection efficiency.
Q: Does pre-generating chunks actually help performance?
A: Yes! Chunk generation is one of the most CPU-intensive tasks in Minecraft. Pre-generating your world using plugins like Chunky stops real-time generation lag when players explore new areas.
Ready to optimize your server infrastructure? Explore professional performance plugins and management tools on the Devlio Marketplace.
Discussion & Comments (0)
Leave a Comment
No comments yet. Be the first to share your thoughts!