7 Days To Die Linux

7 Days To Die Linux

Reading time1 min
#Gaming#Linux#Servers#7DaysToDie#GameServerOptimization#LinuxGaming

Optimizing 7 Days to Die Server Performance on Linux: Practical Guide

Resource contention, unpredictable I/O spikes, and random crash loops: these are routine concerns for anyone hosting a 7 Days to Die (7DTD) server. Harden a Linux machine correctly and you’ll see low tick latency and predictable uptime, even under weekend peak population.


Why Linux?

Windows server deployments often absorb idle CPU cycles with GUIs and background services. Under Linux, the same hardware handles twice the connections, assuming equal tuning. Custom kernels, per-process ulimits, and hands-off upgrades—all straightforward.

That’s the theory. Here’s how you actually get there.


1. Distribution & Kernel Version

  • Best Pick: Ubuntu Server LTS 22.04 or Debian 12 Stable. CentOS stripped bare also works, but troubleshooting community is thinner for gaming.
  • Kernel: If you see player lag during large hordes, swap to a low-latency kernel:
sudo apt-get install linux-lowlatency
  • Note: Stock kernels after 5.15 have adequate I/O scheduling. However, vanilla lowlatency kernels prioritize your game server threads—observable improvement, especially for busy PvE servers.

  • Don’t chase bleeding edge: 6.x kernels occasionally break SteamCMD compatibility or kernel modules (e.g., WireGuard).


2. SteamCMD Installation & Secure User Separation

Never run game servers as root.
Create a dedicated system user:

sudo adduser --disabled-login --gecos "" steam
sudo -iu steam
mkdir ~/steamcmd && cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzf steamcmd_linux.tar.gz

Isolate server binaries from user data; set permissions strictly:

# As steam user:
./steamcmd.sh +login anonymous +force_install_dir ~/7dtd_server +app_update 294420 validate +quit

Gotcha: Occasionally, SteamCMD update fails with “ERROR! Failed to install app ‘294420’”. Retrying often resolves, but audit disk quota and available inodes.


3. System Limits & Network Stack

File Descriptors

7DTD’s networking demands can exhaust default nofile limits (1024). Bump to at least 100k:

Edit /etc/security/limits.conf:

steam   soft    nofile  100000
steam   hard    nofile  100000

Within your systemd service /etc/systemd/system/7dtd.service:

[Service]
User=steam
WorkingDirectory=/home/steam/7dtd_server
ExecStart=/home/steam/7dtd_server/startserver.sh -configfile=serverconfig.xml
LimitNOFILE=100000

Apply:

sudo systemctl daemon-reload
sudo systemctl restart 7dtd.service

Miss this, and you’ll see logs full of Too many open files errors after 30+ players.

Network Tuning

Append to /etc/sysctl.d/99-7dtd.conf:

net.core.somaxconn=4096
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=4096
net.ipv4.ip_local_port_range=10240 60999

Apply live:

sudo sysctl --system
  • Side effect: Tuning these values can affect other services. Monitor with ss -s and compare baseline.

4. Process Scheduling: nice, renice, and CPU Caps

Pin priority to keep game logic snappy (especially important if sharing host with Discord bots or monitoring tools).

Launch with increased CPU priority:

nice -n -5 ./startserver.sh -configfile=serverconfig.xml &

Optionally, restrict sidecar tools or non-critical cron tasks:

cpulimit -e logrotated -l 30 &
  • Note: Over-prioritization leads to hard lockups on older dual-core VPSes. Check htop for CPU steal%.

5. Persistent Sessions: tmux > screen

Simpler to script, easier to recover from SSH drops:

tmux new-session -s 7dtd './startserver.sh -configfile=serverconfig.xml'

Common issue: accidental detach—return with:

tmux attach -t 7dtd

If running periodic manual hotfixes, set up automatic logging with tmux’s built-in buffer dump.


6. Backups & Crash Resilience

Example: scheduled backup and watchdog.

Backup script /home/steam/backup_7dtd.sh:

#!/bin/bash
set -e
STAMP="$(date +%F_%H-%M)"
BACKUP_DIR="/home/steam/backups/$STAMP"
mkdir -p "$BACKUP_DIR"
cp -r /home/steam/7dtd_server/Saves "$BACKUP_DIR/"
cp /home/steam/7dtd_server/serverconfig.xml "$BACKUP_DIR/"
tar czf "/home/steam/backups/save_backup_${STAMP}.tar.gz" -C "/home/steam/7dtd_server" Saves serverconfig.xml
echo "Backup completed $STAMP" >> /home/steam/backups/backup.log
find /home/steam/backups/ -mindepth 1 -mtime +7 -delete

Automatic cleanup (keep last 7 days) prevents slow disks from filling.

Cron scheduling (crontab -e):

0 3 * * * /home/steam/backup_7dtd.sh >/dev/null 2>&1

Watchdog restart:

#!/bin/bash
while true; do
    ./startserver.sh -configfile=serverconfig.xml
    echo "Server stopped at $(date). Restarting in 10s." >> crash.log
    sleep 10
done
  • Known issue: On segfault, watchdog restarts, but deeper bugs (world corruption) persist. Snapshot retention matters.

7. Monitoring: htop and Netdata

Install Netdata for immediate anomaly detection:

bash <(curl -Ss https://my-netdata.io/kickstart.sh)

Monitors per-process memory, CPU, networking, and disk I/O in real time. Drill down to see kernel context switches or anomalous open file descriptors.

  • Practical tip: Check for early memory leaks by looking at the Resident Set Size (RSS) of 7DaysToDie.x86_64 process over time.

Final Notes and Non-Obvious Tips

  • Avoid “auto” OS updates. Kernel upgrades reboot your game out from under players. Schedule restarts after midweek low population.
  • NFS/SMB mounting world files for multi-node setups is not supported; leads to save corruption.
  • Slower SSDs impact chunk load times during horde night. If on VPS, confirm actual disk type—some claim SSD, then throttle under load.

Summary Table: Key Configurations

AreaRecommended SettingGotcha/Side Effect
Kernellinux-lowlatency 5.15+Do not use RC kernels
Usernon-root steam userFails if file permissions misaligned
ulimitsnofile=100000Revert after reboot if not systemd
Networksomaxconn=4096, port_range=wideMay affect other daemons
BackupsRotate, 7-day retentionFull disk will crash server

Real-World Example:
Saw a “Too many open files” crash mid-event; post-mortem revealed backup jobs temporarily doubling open handles. Solution: stagger intensive cron jobs by 10 minutes.


Well-tuned Linux servers outperform Windows in reliability and total slot density for 7DTD. Missing single limits or scheduling steps can degrade performance or outright crash sessions, so approach each configuration with intent. For clustered failover or Dockerized deployment, more advanced tuning (CPU pinning, IO cgroups) is required—out of scope for this summary.


If you’re experimenting with modded servers or orchestrating across multiple hosts, consider using custom launch wrappers or failover scripts for further resilience.

Happy engineering.