Understanding TCP Flow Control vs Congestion Control: Key Differences and Mechanisms
This article explains TCP’s flow control and congestion control mechanisms, detailing sliding window operation, zero‑window probing, SWS, window scaling, and the core congestion algorithms (slow start, congestion avoidance, fast retransmit/recovery), and clearly contrasts their purposes, scopes, and key variables.
1. TCP Flow Control
Flow control prevents the sender from overwhelming the receiver by matching the sending rate to the receiver’s buffer capacity.
1.1 Sliding Window Mechanism
The receiver advertises a receive window ( rwnd) in the TCP header, indicating how many bytes it can accept. The sender limits its send window to min(rwnd, cwnd) and adjusts based on rwnd updates. LastByteSent: sequence number of the last byte sent. LastByteAcked: sequence number of the last byte acknowledged. SendWindow: maximum bytes the sender may transmit, limited by rwnd and cwnd.
The receiver maintains: NextByteExpected: sequence number of the next expected byte. LastByteRcvd: sequence number of the last byte received. ReceiveWindow: remaining buffer space.
The effective send window is min(rwnd, cwnd). If rwnd becomes zero, the sender pauses until a non‑zero window is advertised.
1.2 Challenges and Solutions
Zero‑Window Probing (ZWP) and Persistent Timer
When rwnd is zero, the sender starts a persistent timer. If a non‑zero window update is lost, the timer expires and the sender transmits a one‑byte ZWP segment to provoke an ACK with the current window size.
Small Window Syndrome (SWS)
SWS occurs when the sender or receiver processes data too slowly, causing many small packets and low efficiency. Mitigations include avoiding tiny window advertisements and using Nagle’s algorithm or disabling it with TCP_NODELAY.
Window Scaling
Because the 16‑bit window field caps at 65 KB, high‑speed networks use the TCP window‑scaling option (RFC 1323) to shift the window value, allowing up to 1 GB. In Linux this is controlled by net.ipv4.tcp_window_scaling.
2. TCP Congestion Control
Congestion control limits the amount of data injected into the network to avoid router or link overload.
2.1 Congestion Window (cwnd) and Send Window
The sender maintains a congestion window ( cwnd) that reflects its estimate of network capacity. The actual send window is min(rwnd, cwnd). Even with a large rwnd, a small cwnd forces the sender to throttle transmission.
2.2 Core Congestion‑Control Algorithms
Slow Start – cwnd starts at one MSS and doubles each RTT until reaching the slow‑start threshold ( ssthresh).
Slow‑Start Threshold – when cwnd reaches ssthresh, TCP switches to congestion avoidance.
Congestion Avoidance – cwnd grows linearly, adding roughly one MSS per RTT.
Fast Retransmit and Fast Recovery – triggered by three duplicate ACKs, allowing immediate retransmission and a more gradual cwnd reduction.
2.3 Modern Congestion‑Control Variants
Beyond Tahoe and Reno, algorithms such as SACK, D‑SACK, BIC‑TCP, CUBIC, Vegas, and Google’s BBR use selective acknowledgments, delay‑based measurements, or bandwidth probing to improve throughput and latency on high‑speed, high‑delay networks.
3. Differences Between Flow Control and Congestion Control
Flow control operates point‑to‑point, using the receiver’s advertised window ( rwnd) to prevent buffer overflow. Congestion control is global, using network signals (loss, RTT) to adjust cwnd and avoid network overload. Their objectives, scope, variables, and trigger mechanisms differ as summarized in the table.
4. Conclusion
TCP’s flow control and congestion control work together as a “dual insurance” to ensure reliable and efficient data transfer. Flow control protects the receiver, while congestion control safeguards the overall network, and the effective sending rate is min(rwnd, cwnd).
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
