Minecraft Server Performance & Lag Optimization Guide
Experiencing low TPS (ticks per second), block lag, or stuttering on your Minecraft server? This guide covers the proven optimizations for Paper, Purpur, Java garbage collection, and entity tuning.
1. Optimize Java Launch Flags (Aikar's Flags)
Default Java garbage collection often pauses the server for hundreds of milliseconds. Use Aikar's G1GC Flags to ensure seamless garbage collection:
java -Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar --noguiRule of Thumb: Set
-Xmsequal to-Xmxso Java allocates heap memory immediately without resizing lag.
2. Tune server.properties
Open server.properties and adjust these high-impact variables:
view-distance=8
simulation-distance=5
network-compression-threshold=256- Reducing
simulation-distanceto 5 significantly reduces entity and redstone calculations without impacting player sight range.
3. Optimize paper-world-defaults.yml
In your server directory, edit config/paper-world-defaults.yml:
chunks:
auto-save-interval: 6000
max-auto-save-chunks-per-tick: 8
prevent-moving-into-unloaded-chunks: true
entities:
spawning:
despawn-ranges:
monster:
soft: 30
hard: 724. Optimize spigot.yml (Entity Activation Range)
Open spigot.yml and tune how far mobs can be before their AI ticks are throttled:
world-settings:
default:
entity-activation-range:
animals: 16
monsters: 24
raiders: 32
misc: 8
tick-inactive-villagers: false5. Diagnose Bottlenecks with Spark
Install the free Spark plugin. In-game, run:
/spark profiler --timeout 60Spark generates an interactive web link showing exactly which plugin, entity type, or redstone contraption is causing TPS drops.
Ready for your own game server?
Launch your own gaming project on our high-performance KVM VPS with maximum AMD Ryzen single-core power, ultra-fast NVMe storage, and real Layer 3/4/7 DDoS protection (PletX & SmartNet). 100% prepaid with no contract lock-in.