====== TCP ====== ==== FLOW CONTROL ==== Flow control - is a mechanism to prevent the server from overwhelming the receiver with data it may not be able to process. This is by advertising **rwnd** (receive window) by each side. **rwnd** - the size of available buffer to receive data. ==== CONGESTION CONTROL ==== Congestion control - is a set of mechanisms aimed at preventing the network from being overwhelmed. Example mechanisms are - //Slow Start//, //Congestion Avoidance// **Slow Start** - allows TCP to slowly probe the network to determine the available capacity. It's used at the beginning of the transfer or after repairing loss, detected by retransmission timer. To start, a server initialises a new //congestion window// - sender side limit on the amount of data it can have in flight before receiving an ACK. **Congestion Avoidance** - when TCP detects a packet loss, it adjusts a **cwnd** and after that //Congestion Avoidance// algorithm kicks in (e.g. BBR, CUBIC etc...) ==== BANDWIDTH DELAY PRODUCT ==== BDP (also called "the optimal window size") - the maximum amount of unacknowledged data that can be in the flight at any point in time. Example calculating the max BW for **rwnd** = 16KB and RTT = 100ms. BW bits/s = RWND bits / RTT sec BDP (RWND bits) = BW bits/s * RTT sec (16*1024*8)/0.1 = 131072/0.1 = 1,310,720 bits/s (1,31 Mbps)