Linux Kernel Performance Tuning for High-Load VPS
Sysctl optimization, TCP stack tuning, and I/O scheduler selection for the hardcore sysadmin.
Optimizing the TCP Stack for Concurrency
By default, Linux is tuned for general-purpose use. For high-load web servers, you can significantly improve performance by adjusting the TCP stack via `sysctl`. Increasing `net.core.somaxconn` allows your server to handle more simultaneous connection requests, while tuning `net.ipv4.tcp_fin_timeout` helps free up sockets faster. These small changes can mean the difference between handled traffic and a 'Connection Refused' error during a spike.
Disk I/O Schedulers for NVMe
Traditional disk schedulers like CFQ were designed for spinning disks. For the NVMe drives used at AIHostOn, the 'none' or 'mq-deadline' schedulers are often the best choice as they minimize CPU overhead. We also recommend enabling 'noatime' in your `/etc/fstab` to prevent the system from writing metadata every time a file is read, further reducing disk I/O and improving performance.
sysctl -w net.core.somaxconn=1024 echo 'none' > /sys/block/nvme0n1/queue/scheduler

