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’ buffers 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.
- Start with
cwnd = 1segment. - For every ACK received, double the
cwnd. - Growth is exponential until a threshold (
sshtresh) is reached.
Congestion Avoidance (AIMD)
Additive Increase, Multiplicative Decrease.
- Increase: Once past the threshold, increase
cwndby only 1 segment per round trip (Linear growth). - Decrease: If a timeout occurs (Packet loss), cut
cwndin half immediately.
4. Interactive: The Congestion Sawtooth
Watch the window grow and collapse.
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.