TCP Flow Control and Congestion Control
Published:
Two critical mechanisms within TCP, flow control and congestion control and their differences.
TCP Flow Control
- Decides how much data should be sent/ the flow of data
Ensure the sender does not overflow receiver’s buffer by transmitting too much, too fast
- How flow control works:
- Receiver Advertises RcvWindow: The receiver communicates its available buffer space to the sender through the RcvWindow (Receive Window).
- Sender Limits Unacknowledged Data: The sender adjusts its data transmission to ensure that the unacknowledged data does not exceed the RcvWindow, thereby preventing buffer overflow at the receiver’s end.
Flow control is an end-to-end mechanism, meaning each intermediate network device independently manages the flow of data through its specific network segment.
TCP Congestion Control
Congestion control addresses the issue of too much traffic going through the network, which can exceed the network’s handling capacity. This congestion results in routers dropping packets or delaying them beyond acceptable limits, causing timeouts at the sender.
Mechanism:
- Probing for Usable Bandwidth: TCP probes the network for available bandwidth by increasing the transmission rate until packet loss occurs, then decreases the rate.
- Additive Increase, Multiplicative Decrease (AIMD): TCP incrementally increases the congestion window (CongWin) and decreases it multiplicatively when packet loss is detected.
Congestion Detection:
TCP infers congestion through timeouts or duplicate acknowledgments (ACKs), defining a loss event.
TCP Congestion Control Algorithm Components:
AIMD:
- Increase CongestionWindow additively until a threshold is reached.
- TCP increases CongestionWindow by:
(Maximum Segment Size) * (Maximum Segment Size/CongWindow) for every ACK received
Example: If MSS = 1460 and CongWin = 14600, then:
CongWin increased by1460 * 1460/14600 = 146 - Upon packet loss detection, cut CongestionWindow in half.
Slow Start:
- Initial phase where the sender starts by sending a small number of packets, doubling the packets sent for each acknowledged packet received.
- Continues until reaching the congestion window (cwnd) threshold, then transitions to congestion avoidance.
TCP Reaction to a Loss Event:
TCP Tahoe:
- Threshold = CongestionWindow / 2
- Set CongestionWindow = 1 MSS
- Slow start until threshold, then additive increase.
- Tahoe is slower as it resets the cwnd to 1 on each loss event.
TCP Reno:
- If 3 duplicate ACKs:
- Threshold = CongWin / 2
- CongWin = Threshold + 3MSS
- Additive increase.
- If 3 duplicate ACKs: