Overview
A well-tuned game server provides better player experience with lower latency and fewer lag spikes. This guide covers universal optimization techniques that apply to most dedicated game servers.
System-Level Optimizations
Disable Unnecessary Services
# List running services
systemctl list-units --type=service --state=running
# Disable services you do not need
sudo systemctl disable --now snapd
sudo systemctl disable --now unattended-upgradesKernel Network Tuning
sudo tee -a /etc/sysctl.d/99-gameserver.conf <<EOF
# Increase UDP buffer sizes
net.core.rmem_max = 26214400
net.core.wmem_max = 26214400
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
# Reduce swappiness
vm.swappiness = 10
# Increase max file descriptors
fs.file-max = 100000
EOF
sudo sysctl --systemCPU Governor
# Set CPU to performance mode
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governorMemory Management
- Never allocate all available RAM to the game — leave 1-2 GB for the OS
- Add swap as a safety net but aim to avoid using it
- Monitor with
free -handvmstat 1
Scheduling and Priority
# Run game server with higher priority
nice -n -5 ./start-server.sh
# Or adjust after starting
renice -n -5 -p $(pidof server_binary)Disk I/O
- Use SSD storage whenever possible
- Schedule auto-saves during low-activity periods
- Keep backups on a separate disk or off-server
Network
- Choose a data center close to your player base
- Reduce view/render distance to lower network load
- Consider DDoS protection for public servers
Monitoring
# Real-time resource monitoring
htop
# Network connections
ss -tunp | grep GAME_PORT
# Disk I/O
iotop -o