TCP and Its Algorithms (Slow-Start, Congestion Avoidance, Fast Retransmit and Fast Recovery)
TCP and Its Algorithms (Slow-Start, Congestion Avoidance, Fast Retransmit and Fast Recovery)
TCP and Its Algorithms (Slow-Start, Congestion Avoidance, Fast Retransmit and Fast Recovery)
TCP and its Algorithms (Slow-Start, Congestion Avoidance, Fast Retransmit and Fast Recovery) TCP is a complex transport layer protocol containing four interwined algorithms: Slowstart, congestion avoidance, fast retransmit and fast recovery. In Slow-start phase, TCP increases the congestion window each time an acknowledgement is received, by number of packets acknowledged. This strategy effectively doubles the TCP congestion window for every round trip time (RTT). When the congestion window exceeds a threshold named ssthresh, it enters congestion avoidance phase. TCP congestion window is increased by 1 for each RTT until a loss event occurs. TCP maintains a timer after sending out a packet, if no acknowledgement is received after the timer is expired, the packet is considered as lost. However, this might take too long for TCP to realize a packet is lost and take action. A fast retransmit algorithm is proposed to make use of duplicate ACKs to detect packet loss. In fast retransmit, when an acknowledgement packet with the same sequence number is received a specified number of times (normally set to 3), TCP sender is reasonably confident that the TCP packet is lost and will retransmit the packet. Fast recovery is closely related to fast retransmit. When a loss event is detected by TCP sender, a fast retransmit is performed. If fast recovery is used, TCP sender will not enter slow-start phase, instead it will reduce the congestion window by half, and inflates the congestion window by calculating usable window using min(awin, cwnd+ndup), where awin is the receivers window, cwnd is the congestion window, and ndup is number of dup ACK received. When an acknowledgement of new data (called recovery ACK) is received, it returns to congestion avoidance phase.
2. Tahoe, Reno, NewReno, and SACK TCP Tahoe is the simplest one out of the four variants. It doesnt have fast recovery. At congestion avoidance phase, it treats the triple duplicate ACKs same as timeout. When timeout or triple duplicate ACKs is received, it will perform fast retransmit, reduce congestion window to 1, and enters slow-start phase. TCP Reno differs from TCP Tahoe at congestion avoidance. When triple duplicate ACKs are received, it will halve the congestion window, perform a fast retransmit, and enters fast recovery. If a timeout event occurs, it will enter slow-start, same as TCP Tahoe. TCP Reno is effective to recover from a single packet loss, but it still suffers from performance problems when multiple packets are dropped from a window of data. TCP NewReno tries to improve the TCP Renos performance when a burst of packets are lost by modifying the fast recovery algorithm. In TCP NewReno, a new data ACK is not enough to take TCP out of fast recovery to congestion avoidance. Instead it requires all the packets outstanding at the start of the fast recovery period are acknowledged. TCP NewReno works by assuming that the packet that immediately follows the partial ACK received at fast recovery is lost, and retransmit the packet. However, this might not be true and it affects the performance of TCP. SACK TCP adds a number of SACK blocks in TCP packet, where each SACK block acknowledges a non-contiguous set of data has been received. The main difference between SACK TCP and Reno TCP implementations is in the behavior when multiple packets are dropped from one window of data. SACK sender maintains the information which packets is missed at receiver and only retransmits these packets. When all the outstanding packets at the start of fast recovery are acknowledged, SACK exits fast recovery and enters congestion avoidance. Note that the four variants of TCP only differs when theres a packet loss. If all packets reach the destination successfully, the four variants behave the same.