Skip to main content
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 periodically

How 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

  1. Install Spark profiler
  2. Profile during a lag spike
  3. Check if GC, disk I/O, or plugins cause it
  4. 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.

Related Errors

Need More Help?