TCP Congestion Control
How TCP avoids melting the network — slow start, AIMD, and ECN
Flow control protected the receiver. Congestion control protects everything in between — the shared routers and links of the network. TCP has no direct view of the network’s state, so it cleverly infers congestion from packet loss and adjusts how fast it sends.
The congestion problem
The links between hosts are shared by everyone. If senders push too much data, router queues fill up and packets get dropped. If every sender just kept blasting, the network would collapse under congestion. Congestion control makes senders self-regulate.
A second window: cwnd
TCP keeps a second limit called the congestion window (cwnd), separate from the receiver’s rwnd. While rwnd reflects the receiver’s capacity, cwnd reflects the sender’s estimate of the network’s capacity. The sender must respect both.
Slow start
A new connection does not know the network’s capacity, so it starts small and ramps up fast: slow start doubles cwnd every round-trip (1, 2, 4, 8 …). Despite the name, this is exponential growth — a quick probe upward until the first sign of trouble.
Congestion avoidance
Once cwnd passes a threshold, TCP switches to congestion avoidance: it grows the window slowly — roughly +1 segment per round-trip. This additive increase gently probes for more bandwidth without provoking loss.
Loss is the signal
Since TCP cannot see the network directly, it treats packet loss as evidence of congestion. On loss, it sharply reduces cwnd (typically halving it) to relieve the network, then resumes growing. This is a multiplicative decrease.
The AIMD sawtooth
Put together, congestion avoidance gives the classic AIMD pattern — Additive Increase, Multiplicative Decrease. Plotted over time, cwnd looks like a sawtooth: climb slowly, drop sharply on loss, climb again. This is what keeps many TCP flows sharing a link fairly.
ECN — a gentler signal
Waiting for a drop is wasteful. ECN (Explicit Congestion Notification) lets routers mark a packet as "congestion building" instead of dropping it. The receiver echoes the mark back, and the sender slows down before any data is actually lost. It is a mechanism (across IP and TCP), not an algorithm.
How much can I send?
The rule: At any moment the sender may have at most MIN(cwnd, rwnd) bytes in flight — the smaller of the network’s limit and the receiver’s limit. Both flow control and congestion control apply at once.