Detailed Explanation of TCP Duplicate ACK and Fast Retransmission Mechanisms

Detailed Explanation of TCP Duplicate ACK and Fast Retransmission Mechanisms

1. Problem Background
In TCP communication, the receiver sends an ACK (Acknowledgement) packet for each data segment received, informing the sender that "data up to a certain sequence number has been successfully received." However, if the receiver receives out-of-order data segments (e.g., receiving data with sequence numbers 1000-2000 before receiving data with sequence numbers 500-1000), Duplicate ACK may be triggered, leading to Fast Retransmit.


2. Generation of Duplicate ACK
Assume the sender transmits three consecutive data segments:

  • Segment 1: Seq=1000, Len=1000
  • Segment 2: Seq=2000, Len=1000
  • Segment 3: Seq=3000, Len=1000

If the receiver receives Segment 1 (Seq=1000) and replies with ACK=2000 (expecting the next sequence number to be 2000), but Segment 2 is delayed and Segment 3 arrives first:

  • The receiver checks Segment 3's Seq=3000, finds it is not the expected Seq=2000, and immediately replies with ACK=2000 (duplicating the previous acknowledgment number).
  • The meaning of a duplicate ACK is: "I am still waiting for data with sequence number 2000. Please retransmit it as soon as possible."

Key Rules:

  • A duplicate ACK is sent only when an out-of-order and non-duplicate data segment is received.
  • The acknowledgment number of a duplicate ACK always equals the maximum consecutively received sequence number + 1 (i.e., the expected next sequence number).

3. Trigger Conditions for Fast Retransmit
When the sender receives three or more duplicate ACKs, it assumes that the data segment corresponding to these ACKs is lost (rather than delayed) and immediately retransmits that segment without waiting for the Retransmission Timeout (RTO) timer to expire. This mechanism is called Fast Retransmit.

Why Three Duplicate ACKs?

  • A single duplicate ACK may be triggered accidentally due to network reordering.
  • Three consecutive duplicate ACKs indicate that subsequent data segments are arriving normally, but a middle segment is highly likely lost (ruling out temporary reordering).
  • This threshold balances the risk of false detection with retransmission speed.

4. Detailed Process of Fast Retransmit
Step 1: Detect Duplicate ACK
The sender maintains a "duplicate ACK counter," incrementing it by one for each duplicate ACK received.

Step 2: Trigger Retransmission
When the counter reaches 3:

  1. Immediately retransmit the data segment corresponding to the duplicate ACK's sequence number (e.g., the Seq=2000 segment in the example above).
  2. Enter the Fast Recovery phase (described later).

Step 3: Update Congestion Control

  • Traditional TCP (Tahoe version) reduces the congestion window (cwnd) to 1 and enters slow start.
  • Improved TCP versions (e.g., Reno) perform Fast Recovery to avoid overly reducing transmission efficiency.

5. Brief Introduction to Fast Recovery Mechanism
After Fast Retransmit, the sender executes Fast Recovery:

  1. Halve the congestion window (cwnd = cwnd/2) and set the slow start threshold (ssthresh) = cwnd.
  2. For each duplicate ACK received, slightly increase cwnd (simulating acknowledgment of new data) to maintain data flow.
  3. When an ACK for new data is received, exit Fast Recovery, set cwnd = ssthresh, and enter the congestion avoidance phase.

6. Example Scenario
Assume the sender's window contains data segments Seq=1000~4000, and Segment 2000 is lost:

  1. After receiving Segment 1000, the receiver replies with ACK=2000.
  2. Upon receiving Segment 3000 (out-of-order), it replies with a duplicate ACK=2000.
  3. Upon receiving Segment 4000 (out-of-order), it replies again with a duplicate ACK=2000.
  4. When the sender receives the third duplicate ACK=2000, it immediately retransmits Segment 2000.
  5. After receiving Segment 2000, the receiver replies with ACK=5000 (acknowledging all consecutive data).

7. Comparison with Timeout Retransmission

Feature Fast Retransmit Timeout Retransmission (RTO Expired)
Trigger Condition 3 duplicate ACKs Retransmission timer expires
Response Speed Fast (no need to wait for timeout) Slow (at least one RTO wait)
Congestion Indication Mild congestion (individual packet loss) Severe congestion (link or routing issues)
Window Adjustment Strategy Fast Recovery (cwnd halved) Slow Start (cwnd reset to 1)

8. Summary

  • Duplicate ACK is an important signal for TCP to handle out-of-order or lost packets.
  • Fast Retransmit triggers retransmission early via duplicate ACKs, reducing reliance on timeout mechanisms and improving transmission efficiency.
  • Combined with the Fast Recovery mechanism, it can maintain high throughput while avoiding worsening congestion.