The term "TCO" seems to be a typo or confusion; it likely refers to "TCP" (Transmission Control Protocol), which is the primary transport protocol used on the Internet for reliable communication.
TCP Fast Retransmit is an enhancement to the TCP congestion control algorithm that improves the protocol's ability to detect and react to packet loss quickly. Normally, TCP uses acknowledgments (ACKs) to confirm the receipt of packets; if an ACK is not received for a particular packet within the expected time frame, TCP assumes the packet is lost and retransmits it.
The fast retransmit algorithm works by utilizing the acknowledgment process itself. It does not wait for a retransmission timer to expire before retransmitting a lost packet. Instead, if a sender receives a certain number of duplicate ACKs for the same piece of data (typically three), it interprets this as a sign that the segment immediately following the acknowledged data has been lost, and retransmits it immediately without waiting for a timeout, which can recover lost packets more quickly.
To tune TCP settings in Linux, you can use the sysctl tool, which allows you to read and write kernel parameters at runtime. Here are some relevant parameters you might adjust related to TCP fast retransmit and related behavior:
net.ipv4.tcp_retries2: This controls the number of times TCP retransmits a packet before deciding that the connection is broken.
Adjusting these settings requires root privileges. You can use the sysctl command like so:
sysctl -w net.ipv4.tcp_retries2=<value>
However, it is important to note that modern Linux kernels and the TCP stack are already well-tuned out of the box, and manual tuning is not typically necessary for most users and applications. Additionally, adjusting these parameters without a thorough understanding of TCP behavior and the network conditions can sometimes worsen performance.
The "best" settings depend greatly on the specific use case, network conditions, and system performance. Here are some general considerations for different scenarios:
- High-speed Networks: For networks with high bandwidth and low latency, the default settings usually work well. However, for high-speed long-distance networks (high bandwidth-delay product), you might need to adjust window scaling and buffer sizes to fully utilize the network.
- Lossy Networks: In networks where packet loss is due to congestion rather than link errors, ensuring that the congestion control algorithms like Cubic or BBR are properly configured can be more effective than adjusting retransmission settings.
- Mobile Networks: These may require more aggressive retransmissions due to higher rates of packet loss and variable connectivity.
It is often recommended to run real-world tests and rely on built-in algorithms and tools like TCP BBR (Bottleneck Bandwidth and Round-trip time) congestion control, which can adapt better to different network conditions. Monitoring is crucial: regular observation of network performance indicators can provide guidance on whether any tuning is necessary.
Also, there is the RFC 5681 which brought a different perspective on duplicate ACKs threshold, suggesting that the threshold should be dynamic and calculated per connection, but the common practice still uses the static threshold of three duplicate ACKs.
Before changing any settings in production, make sure to thoroughly research and understand each parameter and how it interacts with your network environment.