Boost Linux Network Performance: Proven Techniques to Increase Bandwidth and Reduce Latency
This article provides a comprehensive guide to Linux network performance tuning, covering key metrics, TCP window adjustments, Fast Open, congestion control algorithms, kernel parameter optimizations, zero‑copy transmission, NIC bonding, connection limits, and essential monitoring tools to achieve higher bandwidth and lower latency.
Key Metrics for Linux Network Tuning
Before tuning, understand the four critical metrics: bandwidth, latency, packet loss, and throughput.
Techniques to Increase Bandwidth
1. Adjust TCP window size
TCP window size controls the amount of data in flight. Increase the receive and send buffers to improve throughput.
sysctl net.ipv4.tcp_rmem
sysctl net.ipv4.tcp_wmem
sysctl -w net.ipv4.tcp_rmem="4096 87380 6291456"
sysctl -w net.ipv4.tcp_wmem="4096 65536 6291456"2. Enable TCP Fast Open
TCP Fast Open reduces connection‑setup latency by allowing data to be sent during the three‑way handshake.
sysctl -w net.ipv4.tcp_fastopen=33. Change TCP congestion control algorithm
Check the current algorithm and switch to BBR for higher throughput on high‑bandwidth, high‑RTT links.
sysctl net.ipv4.tcp_congestion_control
sysctl -w net.ipv4.tcp_congestion_control=bbrTechniques to Reduce Latency
1. Optimize kernel parameters
Increase buffer sizes and adjust timeout and reuse settings to shorten wait times.
sysctl -w net.ipv4.tcp_rmem="4096 87380 6291456"
sysctl -w net.ipv4.tcp_wmem="4096 65536 6291456"
sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_tw_reuse=12. Use efficient NIC drivers and irqbalance
Verify driver version and enable irqbalance to lower interrupt latency.
ethtool -i eth03. Zero‑copy transmission
Use the sendfile() system call to avoid copying data between user and kernel space.
sendfile(socket, file_descriptor, NULL, file_size);4. High‑precision clock synchronization
Synchronize the server clock with NTP to eliminate time‑drift‑induced delays.
ntpq -pNetwork Load Balancing and Optimization
1. Multi‑NIC bonding
Combine multiple network interfaces into a single logical bond to distribute traffic.
ifenslave bond0 eth0 eth12. Tune TCP connection limits
Raise the maximum number of pending connections to handle high concurrency.
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535Monitoring and Analysis Tools
iftop/ nload – real‑time bandwidth usage per interface. netstat / ss – display active sockets and listening ports. iperf – measure bandwidth, latency, and packet loss between hosts.
Conclusion
By adjusting kernel parameters, selecting suitable TCP algorithms, employing zero‑copy, optimizing NICs, and using proper monitoring utilities, administrators can significantly increase bandwidth and lower latency, resulting in more stable and responsive services in data‑center or cloud environments.
Original source: https://blog.csdn.net/absurd/article/details/622055
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
