TCP performance can also be improved by tuning kernel TCP settings. Settings include adjusting send and receive buffer sizes, connection backlog, congestion control, etc.
Initial buffering settings should provide good performance. 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 only 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. The minimum and default values can be left at their defaults minimum=4096 and default=87380.