Chapter 10: TCP Congestion Control
Metadata Card
| Attribute | Content |
|---|---|
| Volume | Vol 4 — Computer Networking |
| Chapter | Chapter 10: TCP Congestion Control |
| Prerequisites | Chapter 3 (TCP Deep Dive: sliding window, flow control) |
| Next | Chapter 6 (Modern Protocols: WebSocket & gRPC) |
| Theory Depth | (4/5) |
| Python Relevance | ≈80%; congestion window simulation, algorithm evolution implementation |
| Core Models | AIMD, slow start, congestion avoidance, fast recovery, CUBIC, BBR |
| Code | ~180 lines |
Your Progress
"The finest regulation mechanism of the post road — TCP congestion control. When too many spell messages jam the post road, all TCP transmission spells must coordinate to slow down, rather than all increasing mana output together. Otherwise, the entire post road will collapse."
Flow control handles "the receiver beacon tower can't keep up." Congestion control handles something completely different: the post road itself is too crowded.
AIMD — The Foundation
- Additive Increase (AI): Each RTT, congestion window + 1 MSS (no packet loss)
- Multiplicative Decrease (MD): On packet loss, congestion window × ½
Slow Start (It's Not Slow)
Initial cwnd = 10 MSS (RFC 6928). Every ACK received, cwnd += 1 MSS.
Initial cwnd = 10
RTT 1: send 10 packets → 10 ACKs → cwnd = 20
RTT 2: send 20 packets → 20 ACKs → cwnd = 40
RTT 3: send 40 packets → 40 ACKs → cwnd = 80Exponential growth (2^N) — doubles every RTT. Ends when cwnd >= ssthresh or packet loss detected.
Congestion Avoidance
After ssthresh, switch to linear growth: each RTT, cwnd += 1 MSS.
AIMD full cycle: Slow start (exponential) → Congestion avoidance (linear +1/RTT) → Loss → MD (×½) → Repeat.
Fast Retransmit & Fast Recovery
Three duplicate ACKs → almost certainly a packet lost → retransmit immediately (don't wait for timeout).
Tahoe: cwnd = 1 (wasteful, restart slow start) Reno: cwnd = cwnd/2 + 3 (preserves experience)
Algorithm Evolution
| Algorithm | Year | Key Innovation |
|---|---|---|
| Tahoe | 1988 | First congestion control: slow start, congestion avoidance, fast retransmit |
| Reno | 1990 | Added fast recovery |
| NewReno | 1999 | Better multi-packet loss handling |
| BIC | 2004 | Binary search for optimal window |
| CUBIC | 2006 | Linux default: cubic function growth, RTT-fair, high-speed friendly |
| BBR | 2016 | Google's paradigm shift: measure bandwidth & RTT instead of using loss as signal |
CUBIC
Window growth is a cubic function: W(t) = C*(t - K)³ + W_max
- Near W_max: grows slowly (stable)
- Far from W_max: grows quickly (recovers bandwidth fast)
- RTT-fair: growth is time-based, not ACK-count-based
BBR — Bottleneck Bandwidth and Round-trip
BBR directly measures two physical quantities:
- BtlBw: Bottleneck bandwidth (narrowest segment)
- RTprop: Minimum RTT without queuing
Send amount per RTT = BtlBw × RTprop (pipe capacity = bandwidth × latency).
No longer uses packet loss as congestion signal — essential for wireless/mobile networks where random loss is common.
Bufferbloat & CoDel
Bufferbloat: Routers with huge buffers. When buffers are too large, RTT can balloon from 20ms to 500ms without any actual link congestion — just excessive queuing.
CoDel (Controlled Delay, 2012): Actively drops packets that have been in the queue too long (>5ms). No configuration parameters needed — it tracks minimum sojourn time.
Traveler's Notes
Congestion control is where TCP becomes truly elegant. The AIMD sawtooth shape — linear growth until loss, then halving — is a decentralized, globally convergent algorithm that requires no central coordinator. Each sender independently detects loss and makes a local decision, yet the entire system converges to fair bandwidth sharing.