Understanding Server Performance
Key Metrics
- TPS (Ticks Per Second): Should be 20 for optimal performance
- RAM Usage: Monitor memory consumption
- CPU Usage: Watch processor load
- Player Count: More players = more resources needed
Performance Target
Your server should maintain 20 TPS (Ticks Per Second) for optimal performance. If TPS drops below 20, players will experience lag.
Performance Indicators
Watch for these warning signs:
- Low TPS (below 20)
- High memory usage
- Slow chunk loading
- Player lag complaints
- Console warnings about performance
Basic Optimizations
Server Properties Optimization
Edit server.properties for better performance:
# Reduce view distance (default: 10)
view-distance=8
# Reduce simulation distance (default: 10)
simulation-distance=6
# Limit chunk loading
max-chunk-neighbor-updates=1000000
# Optimize network
network-compression-threshold=512
Java Arguments
Optimize Java startup arguments:
- Memory: Allocate appropriate RAM (
-Xmxand-Xms) - Garbage Collection: Use optimized GC settings
- Threading: Configure thread settings
- JVM Flags: Add performance JVM flags
Memory Allocation
Don't allocate too much or too little RAM. A good rule is to allocate 2-4GB for small servers, 4-8GB for medium servers, and 8GB+ for large servers. Allocating more RAM than needed can actually hurt performance.
Example optimized arguments:
-Xmx4G -Xms4G -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
Plugin Optimization
Remove Unnecessary Plugins
Plugin Impact
Too many plugins can significantly impact server performance. Regularly audit and remove unused plugins, and consider lightweight alternatives when possible.
- Audit Plugins: Remove unused plugins
- Consolidate: Use plugins that do multiple things
- Lightweight Alternatives: Choose lighter plugin options
- Test Impact: Test performance after removing plugins
Optimize Plugin Configuration
- Disable Unused Features: Turn off features you don't need
- Reduce Check Intervals: Lower frequency of checks
- Optimize Database: If plugins use databases, optimize them
- Cache Settings: Enable caching where available
Performance Plugins
Consider adding optimization plugins:
- Chunk Loaders: Optimize chunk loading
- Entity Limiters: Limit entities per chunk
- Lag Monitors: Track and identify lag sources
- Cleanup Tools: Automatically clean up lag sources
World Optimization
Reduce World Size
- Pre-generate Chunks: Generate chunks before players explore
- Remove Unused Areas: Delete unused world regions
- Limit World Border: Set a world border to limit size
- Regular Cleanup: Remove unused chunks
Optimize Chunk Loading
- Lower View Distance: Reduce
view-distancein server.properties - Chunk Pre-generation: Pre-generate commonly used areas
- Limit Chunk Generation: Restrict chunk generation speed
Entity Management
- Limit Entities: Set entity limits per chunk
- Remove Excess: Regularly clean up excess entities
- Mob Spawn Limits: Reduce mob spawn rates if needed
- Animal Limits: Limit farm animals
Hardware Optimization
RAM Allocation
- Right Amount: Don't allocate too much or too little RAM
- Monitor Usage: Watch actual RAM usage
- Adjust as Needed: Increase if consistently high
- Leave Headroom: Don't use 100% of available RAM
CPU Optimization
- Monitor Usage: Watch CPU usage patterns
- Reduce Load: Optimize to reduce CPU usage
- Upgrade if Needed: Consider more CPU if consistently high
- Thread Optimization: Configure threading appropriately
Storage Optimization
- SSD Storage: Use SSD for better I/O performance
- Regular Cleanup: Remove old logs and backups
- Defragmentation: Defragment if using HDD (rarely needed for SSD)
Advanced Optimizations
Use Optimized Server Software
Consider using optimized server software:
- Paper: Optimized Spigot fork
- Purpur: Further optimized Paper fork
- Fabric with Optimization Mods: For modded servers
- Performance Mods: Add server-side optimization mods
Network Optimization
- Compression: Adjust network compression threshold
- Connection Limits: Limit connections if needed
- Packet Optimization: Use plugins that optimize packets
- Proxy: Use a proxy for better network handling
Database Optimization
If using databases:
- Index Optimization: Optimize database indexes
- Connection Pooling: Use connection pooling
- Query Optimization: Optimize database queries
- Regular Maintenance: Perform database maintenance
Monitoring Performance
Use Performance Tools
- Lag Monitoring Plugins: Track TPS and lag
- Profiling Tools: Identify performance bottlenecks
- Resource Monitors: Monitor RAM, CPU, disk usage
- Player Feedback: Listen to player complaints
Regular Checks
- Daily: Check TPS and basic metrics
- Weekly: Review performance trends
- After Changes: Monitor after making changes
- During Peak Times: Watch performance during busy periods
Troubleshooting Performance Issues
High Lag
- Check TPS: Verify TPS is below 20
- Identify Source: Use profiling to find lag source
- Check Plugins: Disable plugins one by one to find culprit
- Review Logs: Look for performance warnings
- Optimize: Apply relevant optimizations
Lag Investigation
If your server is experiencing lag, start by checking TPS. If TPS is below 20, identify the source using profiling tools or by temporarily disabling plugins one by one.
High Memory Usage
- Check Allocation: Verify RAM allocation is appropriate
- Memory Leaks: Look for memory leaks in plugins
- Reduce Entities: Lower entity counts
- Increase RAM: If legitimately needed, increase allocation
- Optimize Plugins: Optimize memory-heavy plugins
High CPU Usage
- Identify Process: Find what's using CPU
- Optimize Plugins: Optimize CPU-intensive plugins
- Reduce Checks: Lower plugin check frequencies
- Upgrade Hardware: Consider better CPU if needed
Best Practices
- Start Conservative: Begin with basic optimizations
- Monitor Regularly: Keep an eye on performance metrics
- Test Changes: Test optimizations before applying widely
- Document Settings: Keep notes on optimization settings
- Update Regularly: Keep server and plugins updated
- Backup Before Changes: Always backup before major optimizations