Linux VPS Performance Tuning & Kernel Optimization: TCP BBR, Sysctl & Fast I/O
Default Linux kernel configurations are built for conservative general-purpose desktop and low-load server workloads. For high-concurrency web servers, React SSR microservices, and high-traffic APIs handling thousands of simultaneous connections, default socket backlogs and congestion algorithms cause unnecessary latency and dropped connections. In this guide, we optimize the Linux network and I/O subsystem.
1. Activating Google BBRv3 Congestion Control
Traditional TCP congestion algorithms (like CUBIC) treat packet loss as the sole indicator of network congestion, causing throughput to collapse over transatlantic or cellular connections. Google BBR (Bottleneck Bandwidth and Round-trip propagation time) builds a dynamic physical model of the network pipeline, maximizing throughput while keeping queue delays near zero.
# Enable Fair Queuing and BBR in /etc/sysctl.conf
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
2. High-Concurrency Socket Buffer Tuning
To eliminate connection drops during traffic spikes, expand the socket listen backlog, connection tracking limits, and memory buffer allocations in /etc/sysctl.conf:
# Socket Backlogs
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 16384
net.core.netdev_max_backlog = 16384
# TCP Buffer Allocations (Min / Default / Max in bytes)
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# Socket Reuse & File Descriptors
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15
fs.file-max = 2097152
3. NVMe Storage I/O & Memory Swappiness
For modern NVMe flash storage, kernel I/O queuing adds needless CPU overhead. Set the storage scheduler to none and tune dirty page flushing:
# Virtual Memory & Swappiness Tuning
vm.swappiness = 10
vm.dirty_ratio = 15
vm.dirty_background_ratio = 5
vm.vfs_cache_pressure = 50
Apply changes immediately without rebooting via sudo sysctl -p.
