TCP RTT Estimation and Self Clocking
- Each connection is characterized by its Round Trip Time (RTT), which is the time it takes for a segment to be sent and to get its corresponding ACK.
- The following rule must be true:
Timeout >= RTT
- The connection timeout must be slightly greater than the RTT
- if it is smaller than RTT, this will result in unnecessary segment retransmissions
- if it is too much greater than RTT, then whenever a segment is lost, we will wait long for the timeout before resending the segment, which will result in transfer delays for the application.
- For the sake of calculations, RTT will be denoted as SampleRTT.
- SampleRTT fluctuates from one segment to another, because of congestion.
- The study of Jacobson allowed us to calculate segment timeouts and RTT values.
- EstimatedRTT is the average of SampleRTT values, over time. There are two ways to calculate it depending on the TCP implementation.
- Let’s call “r” the estimated RTT and “m” the last measured RTT value.
RTT estimation in the pre-Tahoe implementation
r = α*r + (1-α) * m
Timeout = ß*r, where ß = 2
Over time, the Estimated RTT and the Sample RTT values follow an EWMA rule (Exponential Weighted Moving Averages), where the Sample RTT is exponentially decreasing in favor of theEstimated RTT.
RTT estimation in the Tahoe implementation
- e = m – r
- r = r + g*e
- v = v + g * (|e| – v)
- Timeout = r + ß*v ; ß = 4
- e is the error in the estimate
- g is the EWMA gain, chosen after extensive experimentation
- v is the measured variance (aka the deviation)
ß is also chosen after extensive experimentation
The higher the deviation value is, the higher the Timeout value is.
ACK clocking and Self-clocking
- Let’s suppose we have three hosts A, B and C separated by a bottleneck link B-C. Even if host A initially sends a burst of segments at a high rate (will will be queued at B), C will respond with ACKs at the rate of the B-C link (the rate of the bottleneck link). For each ACK received, A will send a new segment. So the ACKs from C will “clock” the transmission. Since all this is part of TCP, we say that TCP is “self clocking”. This is true as long as:
- bottleneck link is not congested in the direction from the receiver to the sender. Otherwise (if link C-B is congested), ACKs will be slowing down the transmission.
- no ACKs are lost
- Self clocking allows the flow control window to “slide” and thus to introduce new segments into the network.