Infrastructure
How TCP Congestion Control Works
Slow start, congestion avoidance, and the window that keeps the internet from collapsing under its own traffic.
Introduction
Section titled “Introduction”TCP guarantees your bytes arrive intact and in order. It does not guarantee speed — and deliberately so. A sender transmitting as fast as possible from the start would overwhelm routers, cause mass packet loss, and collapse throughput for everyone. Congestion control is the mechanism that prevents that: the sender probes for the path’s capacity, backs off when it finds the limit, and keeps probing.
The core concept
Section titled “The core concept”The central variable is the congestion window, cwnd: the maximum amount of unacknowledged data the sender may have in flight. The receiver’s advertised window (rwnd) protects the receiver’s buffers; the sender may transmit no more than the smaller of the two.
The sender cannot measure the path’s capacity directly, so it infers it from feedback: timely acknowledgements mean the path is coping; lost packets mean it is not. Every congestion control algorithm is a policy for growing cwnd on good news and shrinking it on bad news, with loss as the classic congestion signal.
How it works
Section titled “How it works”The classic algorithm, standardised in RFC 5681, has four phases:
- Slow start. A new connection begins with a small initial window — RFC 6928 raised the permitted initial window to 10 segments (about 14 KB). Each acknowledgement grows cwnd by up to one segment, so the window roughly doubles every round trip. Growth continues until a loss occurs or cwnd reaches the slow start threshold, ssthresh.
- Congestion avoidance. Once cwnd passes ssthresh, growth becomes linear: roughly one extra segment per round trip (formally, cwnd grows by MSS²/cwnd per ACK). The sender now probes cautiously for spare capacity — additive increase.
- Fast retransmit and recovery. If a segment is lost but later ones arrive, the receiver sends a duplicate ACK for each. Three duplicate ACKs tell the sender a segment is missing without waiting for a timeout: it retransmits immediately, sets ssthresh to half the data in flight (at least two segments), and halves its window — multiplicative decrease.
- Timeout. If no ACKs arrive and the retransmission timer fires, the sender assumes severe congestion: ssthresh is halved, cwnd drops to a single segment, and slow start begins again.
The result is the sawtooth: the window climbs, a loss cuts it, and it climbs again.
Beyond Reno: CUBIC and BBR
Section titled “Beyond Reno: CUBIC and BBR”Reno’s linear climb is too slow on fast, long-distance paths, where refilling the window after a loss takes many round trips. CUBIC replaces linear growth with a cubic function of the time since the last congestion event. It has been the default TCP congestion control in Linux since kernel 2.6.19 (2006), and later became the default in macOS and Windows. It is specified in RFC 8312, superseded by RFC 9438 in 2023.
Google’s BBR, published in 2016, takes a different approach entirely. It builds a model of the path — bottleneck bandwidth and minimum round-trip time — and paces packets at the rate the model says the path can carry. Because it does not wait for loss, it avoids filling router buffers — an advantage on lossy or high-latency links, where packet loss does not necessarily mean congestion. In Google’s YouTube deployment, BBR reduced median round-trip time by 53 percent on average globally.
That is the weak spot in loss-based control: it cannot distinguish a packet dropped by a full queue from one corrupted on a wireless link, and it keeps pushing until a queue overflows. The resulting standing queues — bufferbloat — add latency to everything sharing the link.
Misconceptions
Section titled “Misconceptions”First, that congestion control is the network’s job: it is not. Routers simply drop packets when their queues fill; the control loop runs in the sending host, using ACKs and losses as its only sensors. Second, that “slow start” is slow: it is exponential growth, the fastest phase of the algorithm — the caution is only in where it starts.