Monday, December 31, 2012

Slow Start Algorithm in TCP


Slow-start is one of the algorithms that TCP uses to control congestion inside the network. It is also known as the exponential growth phase.

The slow start algorithm can simplified as this: for every acknowledgment received, increase the Congestion  Window by one MSS. For example, if one MSS is 400bytes and our initial Congestion Window is twice that (i.e. 800bytes), we can initially send up to two full segments immediately after the connection is established, but then we have to wait for our segments to be acknowledged by the recipient. For each of the two acknowledgments we then receive, we can increase our Congestion Window by one MSS (400 bytes). So, after we receive two acknowledgments back, our Congestion Window becomes 1600 bytes (800 + 400+ 400). Now we can send up to four full segments before we have to wait for another acknowledgment. and so on. Therefore the Congestion Window increases its size by the number of segments acknowledged.
This exponential increase in the size of the Congestion Window happens until either an acknowledgment is not received for some segment or a predetermined threshold value is reached. 

If a loss event occurs, TCP assumes that it is due to network congestion and takes steps to reduce the offered load on the network. It will halve the slow start threshold, reduce congestion window to 1 MSS, and reset to slow-start state.

Once the threshold has been reached, TCP enters the linear growth phase. At this point, the window is increased by 1 segment for each RTT. This happens until a loss event occurs.

1 comment: