Skip to content
Documentation Background

TCP congestion theory

This is an optional deep dive. TCP congestion control explains the algorithms and tuning. Here are the arguments behind them: what congestion costs, what slow start and AIMD do window by window, how loss rate limits throughput, and why competing flows end up sharing evenly.


Packet loss is a symptom. The cause is too many senders offering too much traffic. Retransmitting a lost packet treats the symptom. Three simplified scenarios show how the cost builds up. In each, link capacity is R.

1. Two senders, a router with unlimited buffers. Each sender gets at most R/2. As the combined load approaches R, the queue grows without bound and delay goes to infinity, even though no packet is lost and throughput is at its maximum.

For a simple queue with random arrivals, average delay scales like 1 / (1 - utilization). At 50% utilization a packet waits about twice its transmission time. At 90% it is ten times, and at 99% it is a hundred times. The edge of capacity is where delay explodes.

2. Two senders, finite buffers, retransmissions. Packets are dropped when the buffer is full, and the senders retransmit. Some of the link now carries retransmitted copies.

CaseOffered loadUseful throughputWhat is wasted
Retransmit only truly lost packetsR/2R/3R/6 goes to retransmissions
Premature timeouts: delayed packets are sent againR/2R/4Router forwards each packet twice, receiver discards the extra

3. Four senders, multi-hop paths. Flows cross several routers. A packet dropped at the second hop has already used capacity on the first. As offered load rises, fresh traffic at the second router crowds out packets arriving from upstream. Upstream links spend their capacity on packets that get dropped downstream. Useful throughput can fall toward zero while every link looks busy. This is congestion collapse, and it happened on the early internet in the 1980s before congestion control was added to TCP.

CostSource
Delay without boundOperating near capacity
Retransmission overheadBuffer overflow
Duplicate copiesTimeouts shorter than the queuing delay
Wasted upstream workDrops late in a multi-hop path

Two broad remedies exist. End-to-end control infers congestion from loss or delay and has no network help, which is how classic TCP works. Network-assisted control has routers signal congestion directly, as ECN does.


Slow start, congestion avoidance, and recovery

Section titled “Slow start, congestion avoidance, and recovery”

The sender limits itself to a congestion window (cwnd), measured here in segments (MSS). The sending rate is about cwnd / RTT. Three phases:

Phasecwnd growthEnds when
Slow start+1 MSS per ACK, which doubles cwnd every RTTcwnd reaches ssthresh, or loss
Congestion avoidance+1 MSS per RTT (linear)Loss
Fast recovery (Reno)Inflate by 1 for each extra duplicate ACKThe missing segment is acknowledged

On loss, ssthresh is set to half of cwnd. What happens next depends on how the loss was noticed:

Loss eventTahoeReno
Timeoutcwnd = 1, slow startcwnd = 1, slow start
Three duplicate ACKscwnd = 1, slow startcwnd = ssthresh, congestion avoidance (via fast recovery)

A timeout means the network may be badly congested, so both versions restart at 1. Three duplicate ACKs mean later segments are still getting through, so Reno keeps the window at half and carries on.

Start at cwnd = 1 with ssthresh = 8. Counts are per RTT.

RTTcwndPhaseEvent
11Slow start
22Slow start
34Slow start
48Slow startReaches ssthresh
59Congestion avoidance
610Congestion avoidance
711Congestion avoidance
812Congestion avoidanceThree duplicate ACKs
96 (Reno)Congestion avoidancessthresh = 6. Reno resumes at 6
107Congestion avoidance
118Congestion avoidanceTimeout
121Slow startssthresh = 4
132Slow start
144Slow startReaches ssthresh
155Congestion avoidance

Tahoe would have gone to 1 at round 9, and grown 1, 2, 4, 6 before turning linear. Reno recovered in one step. The sawtooth this pattern draws on a graph (linear climb, sharp halving) is the signature of AIMD: additive increase, multiplicative decrease.


In congestion avoidance the window climbs from W/2 to W, where W is the window at the moment of loss. The average is the midpoint:

average window = (W/2 + W) / 2 = 0.75 W
average throughput ~ 0.75 x W / RTT

This ties throughput to the window at which loss occurs. A more useful result relates throughput to the loss rate L (the fraction of packets lost). A well-known approximation, from research on TCP steady-state behavior, is:

throughput ~ 1.22 x MSS / (RTT x sqrt(L))

Two consequences matter in practice:

  • Throughput falls with RTT and with the square root of loss. Halving the RTT doubles the rate. Reducing loss by 100 times raises the rate 10 times.
  • A single flow needs astonishingly low loss to fill a fast, long path. With a 1,460-byte MSS and a 50 ms RTT:
Loss rateApproximate throughput of one flow
0.01% (1 in 10,000)28 Mbit/s
0.0001% (1 in 1,000,000)285 Mbit/s
0.000000081% (about 1 in 1.2 billion)10 Gbit/s

That is why transfers over high-latency links use parallel streams, tuned buffers, or a different algorithm such as BBR or CUBIC (see TCP congestion control), which do not treat every loss as a congestion signal in the same way. It is also a reason to cure loss at the source (a bad cable or an overloaded queue) before tuning anything else.


If K flows share a bottleneck of rate R, a fair outcome gives each R/K. TCP flows do not coordinate, yet they converge there. Work it through with two flows, with R = 100 Mbit/s. Both have the same RTT, so each adds 10 Mbit/s per round while there is no loss. Loss happens when the total passes 100, and both halve.

RoundFlow 1Flow 2TotalDifferenceWhat happens
Start20608040
+10 each307010040At capacity
+10 each408012040Loss, both halve
After halving20406020
+10 each, three rounds507012020Loss, both halve
After halving25356010
+10 each, three rounds556512010Loss, both halve
After halving27.532.5605

Additive increase adds the same amount to both, so it leaves the difference unchanged. Multiplicative decrease halves each rate, and so halves the difference. Each cycle halves the gap, and the flows approach 50/50. On a graph of flow 1 against flow 2, additive increase moves the point up along a 45 degree line, and each halving moves it straight toward the origin. Repeated, the path spirals in toward the equal-share line.

Three things break the neat result:

FactorEffect
Different RTTsFlows with a short RTT grow faster per second. In the simple model, throughput scales as 1/RTT, so a 10 ms flow gets roughly ten times the share of a 100 ms flow
Unresponsive UDPSenders that never back off take what they want, and the TCP flows give way
Many connections per applicationFairness is per connection. An application using 11 connections against 9 single-connection users takes 11 of 20 shares, or 55%

The last point matters for design. Opening more parallel connections is an unfair gain, and it also strains NAT tables, load balancers, and server limits. HTTP/2 and HTTP/3 reduce the need by multiplexing many requests on one connection.