You can also improve TCP Performance by tuning kernel TCP settings. Settings include adjusting send and receive buffer sizes, connection backlog, congestion control, etc.
The initial buffering settings for Linux kernels provide good performance for most
use cases. However for certain applications, tuning buffer settings can significantly benefit
throughput. To change buffer settings, adjust the tcp_rmem
and tcp_wmem using the sysctl
command:
- Receive buffering:
sysctl net.ipv4.tcp_rmem="<min> <default> <max>" - Transmit buffering:
sysctl net.ipv4.tcp_wmem="<min> <default> <max>"
(tcp_rmem and tcp_wmem can also be adjusted for IPV6 and globally with the net.ipv6 and net.core variable prefixes respectively).
Typically it is sufficient to tune the max buffer value. It defines the largest size the buffer can grow to. Suggested alternate values are max=500000 (1/2 Mbyte). Factors such as link latency, packet loss and CPU cache size all influence the affect of the max buffer size values. You can leave the minimum and default values at their defaults (minimum=4096 and default=87380).