Title: TCP Reliable data transfer, RTT and Timer, Flow control
1TCP Reliable data transfer, RTT and Timer, Flow
control
EECS 325/425, Fall 2005 October 3
2- Q1
- What are the differences between
- GBN and SR?
3GBN versus SR
- GBN Sliding window, cumulative acks,
retransmission every un-acked segement - SR Sliding window, individual acks, buffer for
out-of-order packets - Which is better? Tradeoff complexity and
performance.
4- Q2
- What mechanisms are adopted in TCPs reliability
implementation?
5TCP reliability mechanisms
- Checksum
- Cumulative ACKs (no NAKs)
- Sequence numbers (in bytes)
- Timer
- Pipelining (though sliding window size N is
variable) - More related issues reduced Acks, fast
retransmit, timer calculation, exponential backoff
6- Q3
- What does TCP implement, GBN or SR?
7GBN or SR?
- Many TCP implementations
- TCP looks like GBN
- cumulative ACKs
- SendBase and NextSeqNum by sender (in bytes)
- But has SR features
- Buffer out-of-order segments
- Retransmit only lost segments
- Other moficications
- TCP SACK
- More like SR
8- Q4
- Since we use cumulative ACKs (of GBN), can we
reduce the number of ACKs?
9TCP ACK generation RFC 1122, RFC 2581
TCP Receiver action Delayed ACK. Wait up to
500ms for next segment. If no next segment, send
ACK Immediately send single cumulative ACK,
ACKing both in-order segments Immediately send
duplicate ACK, indicating seq. of next
expected byte Immediate send ACK, provided
that segment starts at lower end of gap
Event at Receiver Arrival of in-order segment
with expected seq . All data up to expected seq
already ACKed Arrival of in-order segment
with expected seq . One other segment has ACK
pending Arrival of out-of-order
segment higher-than-expect seq. . Gap
detected Arrival of segment that partially or
completely fills gap
10- Q5
- How can we compute RTT? It is necessary before we
can estimate the timer.
11TCP Round Trip Time and Timeout
- Q how to estimate RTT?
- SampleRTT measured time from segment
transmission until ACK receipt - ignore retransmissions
- SampleRTT will vary, want estimated RTT
smoother - average several recent measurements, not just
current SampleRTT
- Q how to set TCP timeout value?
- longer than RTT
- but RTT varies
- too short premature timeout
- unnecessary retransmissions
- too long slow reaction to segment loss
12TCP Round Trip Time and Timeout
EstimatedRTT (1- ?)EstimatedRTT ?SampleRTT
- Exponential weighted moving average
- influence of past sample decreases exponentially
fast - typical value ? 0.125
13Example RTT estimation
14- Q6
- Then, how does TCP compute the timer?
15TCP Round Trip Time and Timeout
- Setting the timeout
- EstimtedRTT plus safety margin
- large variation in EstimatedRTT -gt larger safety
margin - first estimate of how much SampleRTT deviates
from EstimatedRTT
DevRTT (1-?)DevRTT
?SampleRTT-EstimatedRTT (typically, ? 0.25)
Then set timeout interval
TimeoutInterval EstimatedRTT 4DevRTT
16- Q7
- If TCP frequently timeouts even if it sends only
1 segment per round, does it imply anything, and
how does TCP handle it?
17Exponential back-off
- When?
- Consecutive timeouts, possibly due to severe
congestion - How? On each timeout
- Retransmit the smallest sequence number not yet
acknowledged - Double the timer
- End of exponential back-off
- If ACK is received
18- Q8
- Is a long timer harmful to TCP performance, and
can we prevent timeout at all?
19Problems due to timeouts
- Often the first segment in the sliding window is
not acked - The sender waits until a timeout (during this
period it does nothing) - Then retransmit it, wait again one RTT before the
segment flow continues - Observation on receiving the later segments, the
receiver sends back ACKs (with what ACK?). This
is a useful piece of information!
20- Q9
- What is fast retransmit and how does it work?
21Fast Retransmit
- Time-out period often relatively long
- long delay before resending lost packet
- Detect lost segments via duplicate ACKs.
- Sender often sends many segments back-to-back
- If segment is lost, there will likely be many
duplicate ACKs.
- If sender receives 3 ACKs for the same data, it
supposes that segment after ACKed data was lost - fast retransmit resend segment before timer
expires
22Fast retransmit algorithm
event ACK received, with ACK field value of y
if (y gt SendBase)
SendBase y
if (there are currently not-yet-acknowledged
segments) start
timer
else increment count
of dup ACKs received for y
if (count of dup ACKs received for y 3)
resend segment with
sequence number y
a duplicate ACK for already ACKed segment
fast retransmit
23- Q10
- What is TCP flow control?
24TCP Flow Control
- receive side of TCP connection has a receive
buffer
- speed-matching service matching the send rate to
the receiving apps drain rate - Not congestion control
- app process may be slow at reading from buffer
25TCP Flow control how it works
- Rcvr advertises spare room by including value of
RcvWindow in segments - Sender limits unACKed data to RcvWindow
- guarantees receive buffer doesnt overflow
- (Suppose TCP receiver discards out-of-order
segments) - spare room in buffer
- RcvWindow
- RcvBuffer-LastByteRcvd - LastByteRead
lastByteSent LastByteAcked lt RecvWindow