Date :
Fri, 22 Aug, 2003
Lecture No. 11
(TCP RTT Estimation, Fast Retransmit, Fast Recovery )
Author :
Rupesh R. Mehta
Basic
Terminology
- Round Trip Time (RTT) is defined as time between packet send
and it's Ack is received .
- Congestion Window (CWND) is sender side limit on amount of data
transmission on network before receiving ACK .
- Retransmission Time Out (RTO) is the time set for ACK of
particular packet to be received , after this time packet is declared as
lost and is retransmitted.
- Duplicate ACK (DUP ACK) is ACK send by TCP to other end telling
that a segment might have been lost and telling it the value of next
expected sequence number.
- Slow Start Threshold (ssthresh) is parameter (or value ) used in
controlling data transmission.
-
In Round Trip Time Estimation, Smoothed RTT is given as
follows :
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.
-
Initially, the value for RTO is proposed as : RTO = beta * SRTT. But
there was problem in choosing beta, Less Value of beta
gives around 50% wrong estimation that packet has been lost
and High value of beta makes waiting for long time for lost packets. so,
RTO
= SRTT + 4 * RTT_var
is taken as value for RTO.
-
RTO Backoff is technique which keeps on increasing the RTO value
exponentially whenever there is retransmission, but limited to few
minutes.
-
RTT Sampling
Ambiguity is a problem, arises from the way samples are taken for
the calculation of the average: TCP is unable to distinguish two
separate acknowledgements for the same sequence number. Therefore, we
have the following problem:
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.
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.
-
Using Timestamp to resolve ambiguity is also a good solution. As
the other end will copy the value from the segment being acknowledged
and put it in the ACK and send back to sender , then it is easy to
calculate RTO. But this scheme involves overhead (i.e. can not compress
header).
FAST RETRANSMIT / FAST RECOVERY :
- Fast
Transmission :
When TCP
detects segment loss using retransmission timer, then ssthresh is set to
half of CWND. i.e. ( ssthresh = CWND / 2 ) and CWND
is set to 1-full size segment. Now instead of waiting for
retransmission timer to get off , TCP detects packet loss by looking for
packet re-ordering and retransmit the lost packet. This scheme is called
as " Fast Retransmit". In this algorithm ,
TCP receiver sends an immediate duplicate ACK on out-of-order segment
arrival. The other end TCP deduce from small number ( normally 3 )
of consecutive duplicate ACKs that the segment has been lost and deduces
the starting sequence number of missing segment. The missing segment is
retransmitted.
- Fast
Recovery :
This algorithm says that after Fast Retransmission
Algo. (i.e. after the missing segment has been retransmitted),
Congestion Avoidance but not the slow start is performed. This is an
improvement that allows higher throughput under moderate congestion,
especially for large window. This algorithm governs the transmission of
new data until a fresh (new) ACK arrives.
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 .