TCP Fast Retransmission Mechanism
The TCP fast retransmission mechanism is an optimization algorithm designed to quickly detect and retransmit lost data packets before the timer expires, thereby improving data transmission efficiency.
1. Background and Problem
In the standard TCP reliability mechanism, the sender starts a retransmission timer after sending data. If the timer expires without receiving an acknowledgment (ACK), the sender retransmits the data packet. However, the timeout period (RTO) is usually long (e.g., several hundred milliseconds). When packet loss occurs in the network, the sender must wait a relatively long time before retransmitting, which reduces throughput.
2. Core Idea of Fast Retransmission
When the receiver receives out-of-order data packets (e.g., receiving packet with sequence number 2 first, followed by packet with sequence number 1), it immediately sends duplicate ACKs for the last in-order received packet (called "duplicate ACKs"). If the sender receives three consecutive identical ACKs (i.e., three duplicate ACKs), it infers that the next data packet corresponding to this ACK is lost and retransmits that packet immediately without waiting for the timeout.
3. Detailed Workflow
-
Step 1: Sender sends data packets
Assume the sender sequentially sends data packets with sequence numbers 1, 2, 3, 4, and 5. -
Step 2: Packet loss and out-of-order reception
Packet 3 is lost in the network, but packets 4 and 5 arrive normally at the receiver. The receiver expects the next sequence number to be 3, but upon receiving 4 and 5, it detects a sequence gap. For each out-of-order packet received, it immediately sends a duplicate ACK for the last in-order received packet (i.e., sequence number 2). -
Step 3: Sender detects duplicate ACKs
Upon receiving the first ACK for sequence number 2, the sender records it as a normal acknowledgment. Subsequently, upon receiving three duplicate ACKs for sequence number 2 (four ACKs in total, with the latter three being duplicates), the fast retransmission condition is triggered. -
Step 4: Fast retransmission
The sender immediately retransmits packet 3 without waiting for packet 3's retransmission timer to expire. -
Step 5: Receiver acknowledges the retransmitted packet
After receiving the retransmitted packet 3, and since packets 4 and 5 have already been received, the receiver can now deliver data in order and send an ACK for the highest in-order sequence number (i.e., packet 5).
4. Why Three Duplicate ACKs?
Choosing three duplicate ACKs (i.e., receiving four identical ACKs in total) helps avoid false positives of packet loss due to temporary network reordering (e.g., packet reordering). If only two duplicate ACKs (three ACKs total) were required, minor reordering might trigger unnecessary retransmissions. Three duplicate ACKs strike a balance between detecting packet loss and handling reordering, improving judgment accuracy.
5. Comparison with Timeout Retransmission
- Timeout Retransmission: Relies on timers, has high latency, and significantly impacts throughput.
- Fast Retransmission: Based on duplicate ACK feedback, has low latency, enables faster data transmission recovery, and is often combined with congestion control algorithms (e.g., Fast Recovery).
6. Limitations
Fast retransmission can only detect the loss of a single data packet. If multiple consecutive packets are lost or the network experiences severe reordering, duplicate ACKs may not be triggered, and timeout retransmission must still be relied upon. In such cases, other mechanisms (e.g., Selective Acknowledgment, SACK) are needed for further optimization.