Pages / #networking / #tcp
TCP congestion control
TCP congestion control is how a sender decides how much data to keep in flight: grow the window until a packet is lost, then cut it, which draws a sawtooth.
Drop a packetInteractive
- Standard
- RFC 5681 (2009)
- Fast retransmit trigger
- 3 duplicate ACKs
- ssthresh after a loss
- Half the data in flight
- Congestion avoidance
- About +1 segment per round trip
- CUBIC cut on loss
- ×0.7 (Reno ×0.5)
- Default in Linux, Windows, Apple
- CUBIC
Anatomy of the sawtooth
In words
Slow start, then a straight line
5/5
A new connection knows nothing about the path, so TCP has to slowly probe the network to determine the available capacity 1. In slow start the window grows by up to one segment for every ACK 2, roughly doubling each round trip, and it ends when the window passes ssthresh or a loss is seen 3. Then congestion avoidance adds about one full-sized segment per round trip 4, and keeps going until congestion is detected 5.
5 of 5 quotes found in their sources
-
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
requires TCP to slowly probe the network to determine the available capacity
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
During slow start, a TCP increments cwnd by at most SMSS bytes for each ACK received that cumulatively acknowledges new data.
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
Slow start ends when cwnd exceeds ssthresh
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
During congestion avoidance, cwnd is incremented by roughly 1 full
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
Congestion avoidance continues until congestion is detected.
Quote found in the source
Why loss halves the window
6/6
TCP reads a lost packet as a sign of congestion 1. After 3 duplicate ACKs, fast retransmit resends the missing segment without waiting for the retransmission timer 23, ssthresh drops to half the data in flight 4, and the window is set to ssthresh 5: that drop and the slow climb after it are the sawtooth. If the timer fires instead, the window falls to 1 full-sized segment and slow start begins again 6.
6 of 6 quotes found in their sources
-
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
since loss is an indication of congestion
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
The fast retransmit algorithm uses the arrival of 3 duplicate ACKs
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
without waiting for the retransmission timer to expire
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
ssthresh = max (FlightSize / 2, 2*SMSS)
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
a TCP MUST set cwnd to ssthresh
Quote found in the source -
RFC 5681: TCP Congestion Control (2009) rfc-editor.org
cwnd MUST be set to no more than the loss window, LW, which equals 1 full-sized segment
Quote found in the source
What runs today: CUBIC and BBR
5/5
The halving above is classic Reno. CUBIC, the default in the Linux, Windows and Apple stacks, grows the window along a cubic curve instead of a straight line, and cuts it to 0.7 of its size where Reno uses 0.5 123. Google's BBR stops treating loss as the signal and considers how fast the network is delivering data 4, because loss-based control overreacts, halving the sending rate upon packet loss 5.
5 of 5 quotes found in their sources
-
RFC 9438: CUBIC for Fast and Long-Distance Networks (2023) rfc-editor.org
CUBIC has been adopted as the default TCP congestion control algorithm by the Linux, Windows, and Apple stacks.
Quote found in the source -
RFC 9438: CUBIC for Fast and Long-Distance Networks (2023) rfc-editor.org
uses a cubic function instead of a linear congestion window increase function
Quote found in the source -
RFC 9438: CUBIC for Fast and Long-Distance Networks (2023) rfc-editor.org
CUBIC sets the multiplicative window decrease factor to 0.7, whereas Reno uses 0.5.
Quote found in the source -
TCP BBR congestion control comes to GCP, Google Cloud blog cloud.google.com
BBR considers how fast the network is delivering data
Quote found in the source -
TCP BBR congestion control comes to GCP, Google Cloud blog cloud.google.com
halving the sending rate upon packet loss
Quote found in the source