Introduction
This guide covers comprehensive server optimization techniques, from JVM arguments and server configurations to plugin optimization and world settings, helping you achieve the best possible performance for your Minecraft server.
Hardware Optimization
Recommended Specifications
-
CPU Requirements
- Single-thread performance priority
- Recommended: 4.0GHz+ clock speed
- Multiple cores for additional services
-
RAM Allocation
- Minimum: 4GB for small servers
- Recommended: 8-16GB for medium servers
- Large servers: 16GB+ based on plugins/players
-
Storage
- SSD strongly recommended
- NVMe for best performance
- RAID configurations for redundancy
Storage Configuration
# Linux fstab optimization
/dev/sda1 /minecraft ext4 noatime,nodiratime,errors=remount-ro 0 1
Java Virtual Machine (JVM) Optimization
Garbage Collection
- Aikar's Flags (Recommended)
java -Xms6G -Xmx6G -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 -Dusing.aikars.flags=https://mcflags.emc.gs
-Daikars.new.flags=true
- Memory Settings
# For servers with 8GB RAM
-Xms6G -Xmx6G
# For servers with 16GB RAM
-Xms12G -Xmx12G
Never allocate 100% of system RAM to Minecraft
Server Configuration
server.properties Optimization
# Performance settings
view-distance=8
simulation-distance=6
max-tick-time=60000
network-compression-threshold=512
max-players=100
# Game rules
spawn-protection=0
max-world-size=25000
spigot.yml Configuration
settings:
save-user-cache-on-stop-only: true
moved-wrongly-threshold: 0.0625
moved-too-quickly-multiplier: 10.0
world-settings:
default:
mob-spawn-range: 6
entity-activation-range:
animals: 16
monsters: 24
raiders: 48
misc: 8
merge-radius:
item: 2.5
exp: 3.0
item-despawn-rate: 6000
arrow-despawn-rate: 300
paper.yml Optimization
world-settings:
default:
prevent-moving-into-unloaded-chunks: true
max-auto-save-chunks-per-tick: 6
optimize-explosions: true
mob-spawner-tick-rate: 2
container-update-tick-rate: 3
grass-spread-tick-rate: 4
hopper:
disable-move-event: true
cooldown-when-full: true
max-entity-collisions: 2
use-faster-eigencraft-redstone: true
armor-stands-tick: false
World Optimization
Pre-Generation
- Using WorldBorder
/wb set 5000
/wb fill 20
/wb trim
- Chunk Loading
/chunky radius 5000
/chunky start
View Distance Management
# per-player-view-distance.yml
default-view-distance: 8
max-view-distance: 12
min-view-distance: 4
Plugin Optimization
Plugin Management
-
Essential Plugins Only
- Remove unused plugins
- Combine plugin functionality
- Use lightweight alternatives
-
Plugin Monitoring
/timings on
/timings paste
Common Plugin Optimizations
- ClearLag Settings
interval: 6000
remove:
dropped-items: true
vehicles: false
animals:
enabled: false
interval: 12000
- CoreProtect
check-updates: false
database:
max-async-insert-size: 1000
buffer-size: 1000
Entity and Redstone Management
Entity Limits
# paper.yml
per-player-mob-spawns: true
spawn-limits:
monsters: 50
animals: 10
water-animals: 5
ambient: 1
Redstone Settings
redstone:
engine-mode: alternate
disable-observer-diagonal: true
disable-tripwire-duplication: true
Monitoring and Profiling
Diagnostic Tools
- Spark Plugin
/spark profiler
/spark healthreport
/spark tps
- Timings Analysis
/timings on
/timings report
Performance Testing
Benchmarking
- TPS Testing
/tps
/mspt
- Load Testing
/perf start
/perf stop
Troubleshooting
Common Issues and Solutions
-
High CPU Usage
- Check entity counts
- Review redstone machines
- Monitor chunk loading
- Profile plugin usage
-
Memory Leaks
- Monitor heap usage
- Check plugin memory usage
- Review garbage collection
- Analyze memory dumps
-
Lag Spikes
- Check disk I/O
- Monitor network traffic
- Review automatic saving
- Check chunk loading
Best Practices
General Guidelines
-
Regular Maintenance
- Clear old player data
- Remove unused plugins
- Update configurations
- Monitor performance
-
World Management
- Regular backups
- World border limits
- Entity cleanup
- Chunk pre-generation
-
Plugin Management
- Regular updates
- Configuration review
- Remove duplicates
- Monitor impact
Advanced Optimization
Network Optimization
- TCP Settings (Linux)
sysctl -w net.ipv4.tcp_fastopen=3
sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216
- Firewall Configuration
iptables -A INPUT -p tcp --dport 25565 -j ACCEPT
iptables -A INPUT -p udp --dport 25565 -j ACCEPT
Database Optimization
- MySQL Settings
innodb_buffer_pool_size = 512M
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 0
- SQLite Optimization
database:
type: SQLite
synchronous: OFF
journal_mode: MEMORY
Conclusion
Server optimization is an ongoing process that requires regular monitoring and adjustments. By following this guide, you can create a solid foundation for a high-performance Minecraft server.