Last lecture Connection Establishment Intro to the congestion control and loss recovery mechanism of TCP ------------------------------------------------------------------- Today Further discussion on TCP ------------------------- To avoid generating an inappropriate amount of network traffic for the current network conditions, during a connection TCP employs four congestion control mechanisms: Slow start, congestion avoidance, fast retransmit and fast recovery. These algorithms are used to adjust the amount of unacknowledged data that can be injected into the network and to retransmit segments dropped by the network. Two variables (units in terms of number of packets): 1) sender congestion window (snd_wnd) - always set to < = rcv_wnd. = the amount of data the sender can inject into the network before receiving an ACK The congestion window is increased or decreased during the transfer based on the inferred amount of congestion present in the network. 2) slow start threshold (ssthresh) --- determines which algorithm is used to increase the value of snd_cwnd. If snd_cwnd < ssthresh, increment snd_cwnd by 1 packet every time an ack is received. (slow start phase) For example, after the first ACK is received cwnd will be 2 segments and the sender will be allowed to transmit 2 data packets. This continues until cwnd meets or exceeds ssthresh (or, in some implementations when cwnd equals ssthresh), or loss is detected. In this phase, snd_cwnd is doubled for every round-trip time (RTT). Use Fig 8.9 to illustrate this. If snd_cwnd > ssthresh, increment snd_cwnd by 1/snd_cwnd every time an ack is received. (congestion avoidance phase) In this phase, snd_cwnd will increase by roughly 1 packet for each round-trip time (RTT). Use fig 8.7. Congestion avoidance is used to slowly probe the network for additional capacity. If a packet is dropped, set sshthresh to snd_cwnd/2 and set snd_cwnd to 1. - TCP's default mechanism to detect dropped segments is a timeout. The retransmission timeout (RTO) is based on observations of the average RTT and the standard deviation in that average. In most commercial TCP implementations today, a coarse-grained (500 ms) clock is used - leading to long period of time the connection idles while waiting for the timer to expire. To remedy this, a new mechanism called fast retransmit is added - to trigger the retransmission of a dropped packet sooner than the regular timeout mechanism.