If you're running Rust on a VPS or dedicated server with root access, OS-level tuning can squeeze additional performance from your hardware. These settings are already configured on managed hosting like Space-Node, but VPS users should consider them.
Kernel Parameters
Add to /etc/sysctl.conf:
# Network stack optimization
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 300
# Memory management
vm.swappiness = 10
vm.dirty_ratio = 15
vm.dirty_background_ratio = 5
# File descriptor limits
fs.file-max = 2097152
Apply with: sysctl -p
Key Settings Explained
vm.swappiness = 10: Reduces the kernel's eagerness to swap memory to disk. Rust servers need memory to be in RAM, not on swap. Setting this low keeps the game data in physical memory.
vm.dirty_ratio / dirty_background_ratio: Controls how aggressively Linux writes dirty pages to disk. Lower values mean more frequent smaller writes instead of infrequent large flushes - reducing the lag spike during world saves.
net.core.somaxconn: Increases the maximum connection queue. During wipe day when 200 players connect simultaneously, the default (128) can cause connection failures.
I/O Scheduler
For NVMe SSD drives, use the none scheduler (also called noop):
echo none > /sys/block/nvme0n1/queue/scheduler
NVMe drives have their own internal scheduling, so the kernel scheduler just adds overhead.
For SATA SSD, use mq-deadline:
echo mq-deadline > /sys/block/sda/queue/scheduler
Process Priority
Give the Rust server higher CPU scheduling priority:
nice -n -5 ./RustDedicated -batchmode ...
Or adjust a running process:
renice -5 -p $(pgrep RustDedicated)
For real-time priority (use cautiously):
chrt -r 50 ./RustDedicated -batchmode ...
Transparent Huge Pages
Disable transparent huge pages for Rust servers:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
THP causes memory allocation stalls that create micro-stutters. The Rust server process allocates memory in patterns that don't benefit from huge pages.
Network Buffer Sizes
Increase network buffers for high player counts:
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 87380 16777216
Monitoring Tools
htop: Real-time CPU and memory monitoring. Watch individual core usage - Rust's main thread should be pinned to one core near 100%.
iostat: Monitor disk I/O. During world saves, I/O spikes should be brief on NVMe. Prolonged high I/O indicates storage bottleneck.
ss -s: Socket statistics. Monitor open connections and states.
perf top: CPU profiling. Shows which functions consume the most CPU time - useful for identifying if bottleneck is Rust, Oxide, or system.
When to Tune
Only tune after identifying specific bottlenecks. Blind optimization can worsen performance:
- Profile first (htop, iostat, perf)
- Change one setting at a time
- Measure the impact
- Document changes
These tunings provide 5-15% performance improvement on typical hardware. On managed hosting like Space-Node, the infrastructure team has already applied these optimizations - you just play.
