Congestion Control

[!NOTE] This module explores the core principles of Congestion Control, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.

1. What is Congestion?

While Flow Control prevents the sender from overwhelming the Receiver, Congestion Control prevents the sender from overwhelming the Network (the routers and links in between).

If too many packets are sent into the network, routers’ physical buffers (typically SRAM or DRAM) overflow, leading to massive packet loss and “Congestion Collapse.”

2. The Congestion Window (cwnd)

TCP maintains a second window called cwnd.

  • The actual number of bytes sent is min(Receiver Window, Congestion Window).
  • TCP observes packet loss to “guess” how much traffic the network can handle.

3. The TCP Algorithms

Slow Start

When a connection starts, TCP doesn’t know the capacity.

  1. Start with cwnd = 1 segment.
  2. For every ACK received, double the cwnd.
  3. Growth is exponential until a threshold (ssthresh) is reached.

Congestion Avoidance (AIMD)

Additive Increase, Multiplicative Decrease.

  • Increase: Once past the threshold, increase cwnd by only 1 segment per round trip (Linear growth).
  • Decrease: If a timeout occurs (Packet loss), cut cwnd in half immediately.

Why AIMD? The Mathematical Proof of Fairness AIMD is not arbitrary; it is mathematically required for multiple TCP streams sharing the same bottleneck link to converge to an optimal and fair allocation of bandwidth. If TCP used Additive Decrease (subtracting a fixed amount instead of halving), connections with larger windows would hold onto their bandwidth advantage indefinitely. Multiplicative Decrease ensures that the most aggressive senders back off the fastest, allowing new connections to compete fairly.


4. Interactive: The Congestion Sawtooth

Watch the window grow and collapse.

High
Low
System Idle.

5. Fast Retransmit

If a sender receives 3 Duplicate ACKs for the same packet, it doesn’t wait for a timeout. It assumes the packet was lost and resends it immediately. This speeds up recovery significantly in high-speed networks.