warningServer ErrorsAffects: All versions
How to Fix Random Lag Spikes on Server
Fix Random Lag Spikes by using Aikar's JVM flags, pre-generating chunks, and using an SSD.
Quick Fix
Use Aikar's JVM flags for optimized garbage collection. Pre-generate the world with Chunky.
Error Message
Server experiencing intermittent lag spikes / TPS drops periodicallyHow to Fix
1
Use Aikar's flags: -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200
2
Pre-generate world chunks with Chunky plugin
3
Stagger auto-saves across plugins
4
Move the server to an SSD
5
Use Paper/Purpur for better async chunk loading
Common Causes
- Garbage collection pauses
- Auto-save causing disk I/O spikes
- Chunk generation during exploration
- Scheduled plugin tasks running on main thread
Diagnostic Steps
- Install Spark profiler
- Profile during a lag spike
- Check if GC, disk I/O, or plugins cause it
- Apply the relevant fix
FAQ
What are Aikar's flags?
Optimized JVM garbage collection flags designed specifically for Minecraft servers. They reduce GC pause times significantly.