Linux Kernel Tuning for High-Performance Network Servers

Linux Kernel Tuning for High-Performance Network Servers

The default Linux kernel parameters are designed for general-purpose workloads, but high-performance network servers handling thousands of concurrent connections need significant tuning. Understanding and optimizing kernel networking parameters can dramatically improve throughput and reduce latency.

Essential Kernel Parameters

The TCP backlog queue controlled by net.core.somaxconn and net.ipv4.tcp_max_syn_backlog determines how many incoming connections can be queued before the kernel starts dropping them. For busy web servers, increasing these values from their defaults of 128 and 1024 to 65535 prevents connection drops during traffic spikes.

File descriptor limits are another common bottleneck. Each network connection requires a file descriptor, and the default limit of 1024 per process is woefully inadequate for modern servers. Setting fs.file-max and ulimit values to at least 100000 ensures the system can handle the required connection count.

Memory allocation for network buffers via net.core.rmem_max, net.core.wmem_max, and their TCP-specific counterparts directly impacts throughput for large data transfers. Increasing these buffer sizes to 16MB or more allows the kernel to maintain larger TCP windows, which is essential for achieving high throughput on high-latency network paths.

Back to Blog