乐闻世界logo
搜索文章和话题

What are the four algorithms of TCP congestion control?

2月21日 17:09

TCP Congestion Control Mechanism Explained

TCP congestion control is a key mechanism for network stability, preventing packet loss and performance degradation caused by network congestion.

Four Core Algorithms of Congestion Control

1. Slow Start

  • Initial State: cwnd (congestion window) initialized to 1 MSS (Maximum Segment Size)
  • Exponential Growth: For each ACK received, cwnd doubles; after each RTT, cwnd doubles
  • Threshold Trigger: When cwnd reaches ssthresh (slow start threshold), enter congestion avoidance phase
  • Purpose: Quickly probe available network bandwidth, avoid sending large amounts of data at the beginning causing congestion

2. Congestion Avoidance

  • Linear Growth: After each RTT, cwnd increases by 1 MSS
  • Conservative Strategy: Slower growth than slow start, avoiding sudden network congestion
  • Trigger Condition: Enter this phase when cwnd ≥ ssthresh

3. Fast Retransmit

  • Trigger Condition: Receive 3 duplicate ACKs
  • Immediate Retransmission: Retransmit lost segment immediately without waiting for RTO (retransmission timeout) to expire
  • Reason: Duplicate ACKs indicate middle segment loss, but subsequent segments have arrived

4. Fast Recovery

  • cwnd Adjustment: Set cwnd to ssthresh + 3 × MSS
  • ssthresh Update: ssthresh = cwnd / 2
  • Subsequent Processing: For each duplicate ACK received, cwnd increases by 1; when receiving ACK for new data, cwnd = ssthresh, enter congestion avoidance

Handling When Congestion Occurs

  • Timeout Retransmission: ssthresh = cwnd / 2, cwnd = 1, re-enter slow start
  • Fast Retransmit Trigger: ssthresh = cwnd / 2, cwnd = ssthresh, enter fast recovery
  • What is the difference between slow start and congestion avoidance?
  • Why do we need 3 duplicate ACKs to trigger fast retransmit?
  • How to optimize TCP congestion control to improve network performance?
标签:TCP