Оптимизация сервера Minecraft: TPS и управление памятью
Оптимизация сервера Paper/Purpur, флаги JVM, настройки загрузки чанков и оптимизация плагинов.
Содержание
Introduction
Minecraft server performance is measured by TPS (Ticks Per Second). The ideal TPS value is 20, and dropping below this causes lag, block delay, and degraded player experience. This guide covers maximizing your Minecraft server performance with Paper/Purpur server software, JVM optimization, chunk loading settings, and plugin optimization.
Server Software Selection
Paper vs Purpur vs Spigot
| Feature | Spigot | Paper | Purpur |
|---|---|---|---|
| Performance | Medium | High | Very High |
| Async Chunk Loading | No | Yes | Yes |
| Anti-Xray | No | Yes | Yes |
| Extra Configuration | Low | Medium | High |
| Plugin Compatibility | High | High | High |
Paper or Purpur is recommended for performance-focused servers. Purpur is a fork of Paper with additional optimization options.
Paper Installation
mkdir ~/minecraft && cd ~/minecraft
wget -O paper.jar https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/latest/downloads/paper-1.21.4-latest.jar
JVM Flags Optimization
Aikar's Flags (Recommended)
nano ~/minecraft/start.sh
#!/bin/bash
java -Xms8G -Xmx8G \
-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 \
-jar paper.jar --nogui
chmod +x ~/minecraft/start.sh
JVM Flag Explanations
| Flag | Description |
|---|---|
| -Xms / -Xmx | Min/Max heap size (same value recommended) |
| -XX:+UseG1GC | Use G1 Garbage Collector |
| -XX:MaxGCPauseMillis=200 | Limit GC pause to 200ms |
| -XX:+AlwaysPreTouch | Pre-allocate memory |
| -XX:G1NewSizePercent=30 | Young generation size |
| -XX:G1HeapRegionSize=8M | Heap region size |
Keep -Xms and -Xmx the same. Different values negatively affect GC performance. Allocate 70-80% of total server RAM.
Chunk Loading Optimization
paper-world-defaults.yml
chunks:
auto-save-interval: 6000
delay-chunk-unloads-by: 10s
max-auto-save-chunks-per-tick: 6
prevent-moving-into-unloaded-chunks: true
spigot.yml
world-settings:
default:
view-distance: 6
simulation-distance: 4
mob-spawn-range: 4
entity-activation-range:
animals: 16
monsters: 24
raiders: 48
misc: 8
tick-inactive-villagers: false
nerf-spawner-mobs: true
merge-radius:
item: 3.5
exp: 4.0
bukkit.yml
spawn-limits:
monsters: 30
animals: 8
water-animals: 3
ambient: 1
ticks-per:
animal-spawns: 400
monster-spawns: 4
autosave: 6000
Plugin Optimization
Performance-Affecting Plugins
# Generate timings report (Paper)
/timings on
# Wait 10 minutes
/timings paste
Recommended Optimization Plugins
| Plugin | Function |
|---|---|
| Spark | Performance profiling |
| FarmControl | Farm entity limiting |
| ClearLag | Entity cleanup |
| ViewDistanceTweaks | Dynamic view distance |
Reducing Plugin Count
- Remove unused plugins
- Consolidate plugins with similar functions
- Measure each plugin's TPS impact with Spark
- Replace heavy plugins with alternatives
TPS Monitoring
# In-game TPS check
/tps
# Detailed profiling with Spark
/spark profiler start
# Wait 5 minutes
/spark profiler stop
/spark profiler
TPS Assessment
| TPS | Status |
|---|---|
| 20.0 | Perfect |
| 18-19.9 | Good |
| 15-17.9 | Acceptable |
| 10-14.9 | Poor |
| <10 | Critical |
Memory Management
RAM Allocation Guide
| Player Count | Recommended RAM |
|---|---|
| 1-10 | 4 GB |
| 10-30 | 6-8 GB |
| 30-50 | 8-12 GB |
| 50-100 | 12-16 GB |
| 100+ | 16+ GB |
GC Log Analysis
# Enable GC logs
java -Xlog:gc*:file=gc.log:time,uptime,level,tags -jar paper.jar
# Analyze GC logs
grep "Pause" gc.log | tail -20
Conclusion
Minecraft server optimization is achieved through proper server software selection, JVM flags, chunk loading configuration, and plugin management. Regular TPS monitoring and Spark profiling help identify and resolve performance issues. REXE VDS high-performance NVMe SSDs and powerful CPUs ensure your Minecraft server runs at peak performance.
Связанные статьи
Как установить сервер FiveM: пошаговое руководство
Полное руководство по установке сервера FiveM на REXE VDS: настройка txAdmin, портов и оптимизация производительности для GTA V roleplay-серверов.
Как установить сервер Minecraft: руководство по Paper
Полное руководство по установке сервера Paper/Spigot Minecraft на REXE VDS: настройка Java, управление плагинами и оптимизация производительности для стабильной игры.
Как установить сервер CS2: полное руководство
Полное руководство по установке выделенного сервера CS2 на REXE VDS: SteamCMD, GSLT-токен, настройка сервера, игровые режимы и защита от DDoS через Path Panel.