Sub topic 11
Congestion control: slow start and congestion avoidance
This chapter assumes you know how TCP uses sequence numbers, acknowledgments and retransmission, and how the receive window limits data in flight. It covers how a sender decides how fast to send when the network itself, not the receiver, is the limit.
Why flow control is not enough
Flow control protects the receiver. The receive window (rwnd) tells the sender how much buffer space the receiver has left. A receiver with plenty of buffer can still sit behind a slow or crowded link. If every sender transmits as fast as rwnd allows, router queues fill and overflow, and packets are dropped. The senders then retransmit, which adds more load. This collapse is called congestion collapse.
TCP avoids it by having each sender estimate how much the network can carry. That estimate is the congestion window (cwnd), measured in bytes or in segments of one maximum segment size (MSS). The sender never has more unacknowledged data in flight than the smaller of the two windows:
bytes in flight <= min(cwnd, rwnd)The sender cannot see the network directly. It infers congestion from two signals: a retransmission timeout, and several duplicate acknowledgments in a row.
Slow start
A new connection does not know the path capacity, so it starts small. Modern stacks commonly begin with a cwnd of 10 segments. Despite the name, slow start grows exponentially. Each acknowledged segment raises cwnd by one segment, so cwnd roughly doubles every round-trip time (RTT).
Growth continues until cwnd reaches the slow start threshold (ssthresh) or a loss occurs. Then TCP switches to congestion avoidance.
Congestion avoidance
Above ssthresh, TCP probes more carefully. It raises cwnd by about one MSS per RTT, which is linear growth. This is additive increase.
When loss is detected, TCP cuts the window. This is multiplicative decrease. Together the two rules are called AIMD (additive increase, multiplicative decrease). AIMD lets competing connections converge toward a fair share of a bottleneck link.
The reaction depends on how loss was detected:
| Signal | What it suggests | Typical reaction |
|---|---|---|
| Retransmission timeout | Severe loss, possibly nothing getting through | Set `ssthresh` to half of the data in flight, set `cwnd` to 1 segment, restart slow start |
| Three duplicate ACKs | One segment lost, later segments still arriving | Fast retransmit the missing segment, halve `cwnd`, continue in congestion avoidance (fast recovery) |
A worked example
Assume an MSS of 1 segment, an initial cwnd of 1 and ssthresh of 8.
- RTT 1: send 1 segment. All are acknowledged, so
cwndbecomes 2. - RTT 2: send 2.
cwndbecomes 4. - RTT 3: send 4.
cwndbecomes 8, which equalsssthresh. - RTT 4: congestion avoidance begins. Send 8, and
cwndbecomes 9. - RTT 5: send 9, and
cwndbecomes 10. - Three duplicate ACKs arrive while 10 segments are in flight.
ssthreshbecomes 5 andcwndbecomes 5. Growth continues linearly from there.
If a timeout had occurred instead at step 6, cwnd would drop to 1 and the connection would run slow start again up to the new ssthresh of 5.
Common errors
- Confusing the two windows.
rwndcomes from the receiver and appears in the TCP header.cwndis local to the sender and is never transmitted. - Calling slow start slow. It is the fastest growth phase. The name refers to starting from a small window, not to the growth rate.
- Assuming all loss means congestion. On wireless links, corruption also causes loss. Loss-based TCP still shrinks its window, which lowers throughput.
- Expecting UDP to behave the same way. UDP has no congestion control. An application sending UDP must limit its own rate, or it can crowd out TCP flows. Protocols built on UDP, such as QUIC, implement their own congestion control.
Exercise
A TCP connection has cwnd = 16 segments and ssthresh = 16 segments, and it is in congestion avoidance. A retransmission timeout occurs. What are cwnd and ssthresh immediately afterwards, and which phase does the sender enter?
Show answer
Assuming 16 segments were in flight, ssthresh becomes 8 (half of the data in flight) and cwnd becomes 1 segment. The sender enters slow start, doubling cwnd each RTT (1, 2, 4, 8) until it reaches ssthresh at 8. It then switches back to congestion avoidance and grows by one segment per RTT.
Exercise
A receiver advertises rwnd = 64 KB, and the sender's cwnd is 20 KB. How much unacknowledged data may the sender have in flight, and why?
Show answer
20 KB. The sender is limited by the smaller of cwnd and rwnd. Here the network estimate (cwnd) is the tighter limit, even though the receiver could accept more.