Date  : Fri, 22 Aug, 2003
Lecture No. 11    (TCP RTT Estimation, Fast Retransmit, Fast Recovery )
Author :  Rupesh R. Mehta


 Basic Terminology


                             SRTT = alpha * SRTT + (1-alpha) * RTT_i

                In this calculation the value of alpha is choosen to be 7/8 as asssigning  low value gives emphasis on recent RTT, so sudden spikes in RTT value may affect SRTT . Keeping higher value emphasises on old SRTT value and thus sudden spikes will not affect SRTT value very effectively.

           is taken as value for RTO.                          A timeout occurs before an ACK is received, and PKT1 is retransmitted. The ACK for the first PKT1 arrives a bit later and the source measures a wrong value for the RTT.


DUP-ACK
                                              fig.  RTT is considered as difference between most recently retransmitted and ACK received for the Original packet.    

    Thus  using the original transmission for RTT measurement, causes Over-Estimation, whereas using  the most recent retransmission for RTT measurement causes Under-Estimation and thus gives very negative effect. ( As less RTT tends to reduce in RTO which further causes estimating packet lost even if packet is not lost and thus causes retransmission.) 
  Ignoring RTT sample also leads to the problem of continuos retransmission (reason given below), as RTT changes due to several reasons such as congestion in network , change in route depending on some policy.


                            Rule 1: Ignore measured RTT for retransmitted packets. 
                                         This removes ambiguity from RTT measurements.

                            Rule 2: RTO should be doubled after retransmission.
                                        This is called "Exponential Back-off".

Why is Rule 2 necessary?
When RTO is smaller than Real RTT..
        If only Rule 1 is applied, TCP will use previous RTO forever. Thus all packets will be retransmitted.
        No RTT mesurement happens.


  FAST RETRANSMIT / FAST RECOVERY  :
              
The Algorithm works as follows :  

              If  Number of DUP-ACK received  = 3
                           ssthresh =   CWND / 2;
                            Retransmit the lost segment ;
                            CWND = sshthresh + 3 ;       /*  3 is for 3 DUP-ACKs */

            For each next DUP-ACK
                          Increment CWND  by 1.
                                  /* i.e. CWND = CWND + 1. This inflates the CWND in order to reflect segment that has left the network */


            If   allowed by CWND and Receiver's Advertised Window    
                         Transmit a segment (if any....)                                              

            If  Not DUP-ACK                        /* i.e. New/Fresh  ACK  */
                          CWND = sshthresh         /* Deflating the window */

           Call Congestion Avoidance Algorithm           


 Congestion Avoidance (CA) :

                  Consider,  sender's  CWND = W . Packets going to the receiver have sequence numbers ( U , U+W) , now consider that the packet having sequence no. 'U'  gets dropped, [ U, U+W)  packets are still in transit. On packet loss detection, sender will reduces it's CWND size to half of its original (i.e. W/2).    The receiver will send  W-1 DUP-ACKs in single RTT. Along with retransmitting lost packet, sender will send  at the max. W/2 -1  new packets (as CWND = W/2 ). Thus total number of packets sent  are [ U, U+W/2+W-1) . If only 'U' packet had  lost then the new ACK will ask for the U+W .