Flow control protects the receiver. Congestion control protects the network: if every sender sends as fast as it can, router queues overflow, packets are lost and throughput collapses.

Congestion and the Congestion Window

Congestion happens when the load on the network exceeds its capacity, causing long queues, delay, packet loss and retransmissions, which add even more load (congestion collapse). TCP controls this from the end hosts. The sender keeps a congestion window (cwnd), its estimate of how much the network can carry. The amount it may send is min(cwnd, rwnd). TCP treats packet loss as the sign of congestion: a timeout suggests heavy congestion, and three duplicate ACKs suggest mild congestion. The overall policy is AIMD: additive increase, multiplicative decrease.

Definition: Congestion window. A sender-side limit (cwnd) on the amount of unacknowledged data TCP may have in the network, adjusted according to signs of congestion.

Slow Start and Congestion Avoidance

Slow start: a new connection starts with cwnd = 1 MSS (maximum segment size; modern TCP uses about 10) and increases it by 1 MSS for each ACK, so cwnd doubles every RTT — exponential growth, quickly finding the available capacity. It continues until cwnd reaches the slow-start threshold (ssthresh). Congestion avoidance: above ssthresh, cwnd grows by about 1 MSS per RTT — linear growth, probing carefully for more bandwidth.

Fast Retransmit and Fast Recovery

When the sender receives three duplicate ACKs, it does not wait for the timeout: it retransmits the missing segment at once (fast retransmit). In fast recovery, it sets ssthresh = cwnd / 2 and cwnd = ssthresh (plus 3), and continues in congestion avoidance, since the duplicate ACKs show that data is still flowing. On a timeout, TCP reacts strongly: ssthresh = cwnd / 2, cwnd = 1, and slow start begins again.

TCP Variants

TCP Tahoe had slow start, congestion avoidance and fast retransmit, but on any loss it set cwnd back to 1. TCP Reno added fast recovery, halving cwnd on triple duplicate ACKs instead of restarting, which gives the typical sawtooth pattern. NewReno handles several losses in one window better. TCP Vegas is delay-based: it compares the expected throughput (cwnd / base RTT) with the actual throughput, and reduces cwnd when RTT rises, before losses occur, keeping queues short. Modern systems use CUBIC (the Linux default, whose growth follows a cubic function of time since the last loss, suiting fast long links) and BBR (from Google, which models bottleneck bandwidth and RTT). Routers can help with Active Queue Management such as RED (dropping packets early) and ECN (marking packets instead of dropping them).

Table 3.6: Congestion control phases

Phase or event cwnd change ssthresh
Slow start Doubles each RTT Unchanged
Congestion avoidance +1 MSS each RTT Unchanged
3 duplicate ACKs (Reno) Halved, fast recovery cwnd / 2
Timeout Reset to 1 MSS cwnd / 2

Example 3.6: Tracing TCP Reno

Problem: A TCP Reno connection starts with cwnd = 1 MSS and ssthresh = 16. Triple duplicate ACKs occur at round 8 and a timeout at round 14. Trace cwnd.

Solution:

  1. Slow start: rounds 1–5 give 1, 2, 4, 8, 16; at 16 it reaches ssthresh.
  2. Congestion avoidance: rounds 6–8 give 17, 18, 19.
  3. Round 8 loss (3 dup ACKs): ssthresh = 19 / 2 = 9 and cwnd = 9; linear growth gives 9, 10, 11, 12, 13, 14 in rounds 9–14.
  4. Round 14 timeout: ssthresh = 14 / 2 = 7 and cwnd = 1; slow start again gives 1, 2, 4, then 7 (capped at ssthresh), then 8, 9 in rounds 15–20.

Result: The sawtooth: exponential, linear, halved, linear, reset.

cwnd, ssthresh, trace = 1, 16, []
for rnd in range(1, 21):
    trace.append(cwnd)
    if rnd == 8:                      # triple duplicate ACKs
        ssthresh = cwnd // 2
        cwnd = ssthresh
    elif rnd == 14:                   # timeout
        ssthresh = cwnd // 2
        cwnd = 1
    elif cwnd < ssthresh:
        cwnd = min(cwnd * 2, ssthresh)
    else:
        cwnd += 1
print("round:", " ".join(f"{r:>2}" for r in range(1, 21)))
print("cwnd :", " ".join(f"{c:>2}" for c in trace))

Output

round:  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
cwnd :  1  2  4  8 16 17 18 19  9 10 11 12 13 14  1  2  4  7  8  9

Common mistakes

  • Thinking slow start is slow. It grows exponentially; it is "slow" only compared with sending at full speed at once.
  • Resetting cwnd to 1 on triple duplicate ACKs in Reno. Reno halves it; Tahoe resets it.
  • Forgetting that the sender is limited by min(cwnd, rwnd).

Key takeaways

  • Congestion control keeps senders from overloading the network; the policy is AIMD.
  • Slow start doubles cwnd each RTT up to ssthresh; congestion avoidance adds 1 MSS per RTT.
  • Three duplicate ACKs: fast retransmit and fast recovery (halve cwnd); timeout: cwnd = 1.
  • Reno is loss-based with fast recovery; Vegas is delay-based; CUBIC and BBR are modern.

Practice questions

  1. What is the sending limit of TCP?
  2. What happens on a timeout?
  3. How does TCP Vegas detect congestion?

Answers to the practice questions

  1. The smaller of the congestion window and the receiver window.
  2. ssthresh becomes cwnd / 2, cwnd is set to 1 MSS, and slow start restarts.
  3. From rising round-trip times, before packet loss occurs.

Sources

  • Official BCA syllabus Computer Networks, course code 26BCA404DS02, Unit III