Flow control protects the receiver. Congestion control protects the network. Both limit how fast a TCP sender sends.
Flow control protects the receiver. Every ACK advertises a receive window: how many more bytes the receiver has buffer space for. The sender never has more unacknowledged data in flight than that. If the receiving application stops reading, the window shrinks to zero and the sender pauses. This is how backpressure from a slow consumer reaches the sender.
Congestion control protects the network. The sender keeps its own congestion window. It estimates this window from packet loss, and sometimes from delay.
- Slow start begins with a small window. It roughly doubles the window each round trip until a loss or a threshold.
- After that, growth slows down.
- A loss cuts the window.
Common algorithms are CUBIC (the Linux default) and BBR.
At any moment, the sender is limited by the smaller of the two windows.
- Flow control protects the receiver through the advertised receive window.
- A zero window pauses the sender. This is backpressure.
- Congestion control protects the network through the sender's congestion window.
- Slow start grows the window exponentially, then more carefully, and a loss shrinks it.
- The real limit is the smaller of the two windows.