0% found this document useful (0 votes)
16 views17 pages

Lecture 17-TCP Reliable Data Transfer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

Lecture 17-TCP Reliable Data Transfer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Lecture 17:TCP reliable data transfer

Lecture 17
TCP reliable data transfer
Lecture 17:TCP reliable data transfer

TCP round trip time, timeout

Q: how to set TCP Q: how to estimate RTT?


timeout value? • SampleRTT: measured time
from segment transmission
• longer than RTT
until ACK receipt
– but RTT varies
– ignore retransmissions
• too short: premature • SampleRTT will vary, want
timeout, unnecessary estimated RTT “smoother”
retransmissions – average several recent
• too long: slow reaction measurements, not just
to segment loss current SampleRTT

Transport Layer 3-2


Lecture 17:TCP reliable data transfer

TCP round trip time, timeout


EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
 exponential weighted moving average
 influence of past sample decreases
exponentially fast RTT: gaia.cs.umass.edu to fantasia.eurecom.fr
 typical value:  = 0.125
350

RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

300
(milliseconds)

250
RTT (milliseconds)

200
RTT

sampleRTT
150

EstimatedRTT

100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)

SampleRTT Estimated RTT


Lecture 17:TCP reliable data transfer

TCP round trip time, timeout

• timeout interval: EstimatedRTT plus “safety margin”


– large variation in EstimatedRTT -> larger safety margin
• estimate SampleRTT deviation from EstimatedRTT:

DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically,  = 0.25)

TimeoutInterval = EstimatedRTT + 4*DevRTT

estimated RTT “safety margin”


Lecture 17:TCP reliable data transfer

TCP reliable data transfer

• TCP creates rdt service


on top of IP’s
unreliable service
– pipelined segments
– cumulative acks let’s initially consider
– single retransmission simplified TCP sender
timer
• Retransmissions
triggered by:
– timeout events
– duplicate acks

Transport Layer 3-5


Lecture 17:TCP reliable data transfer
TCP sender events:
data rcvd from app: timeout:
• create segment with • retransmit segment that
seq # caused timeout
• seq # is byte-stream • restart timer
number of first data ack rcvd:
byte in segment • if ack acknowledges
• start timer if not already previously unacked
running segments
– think of timer as for – update what is known to
oldest unacked segment be ACKed
– expiration interval: – start timer if there are
TimeOutInterval still unacked segments

Transport Layer 3-6


Lecture 17:TCP reliable data transfer

TCP sender (simplified)


data received from application above
create segment, seq. #: NextSeqNum
pass segment to IP (i.e., “send”)
NextSeqNum = NextSeqNum + length(data)
if (timer currently not running)
 start timer
NextSeqNum = InitialSeqNum wait
SendBase = InitialSeqNum for
event timeout
retransmit not-yet-acked
segment with
smallest seq. #
ACK received, with ACK field value y start timer

if (y > SendBase) {
SendBase = y
/* SendBase–1: last cumulatively ACKed byte */
if (there are currently not-yet-acked segments)
start timer
}
Lecture 17:TCP reliable data transfer
TCP: retransmission
scenarios
Host A Host B Host A Host B

SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


timeo

timeo
ACK=100
X
ut

ut
ACK=100
ACK=120

Seq=92, 8 bytes of data Seq=92, 8


SendBase=100 bytes of data
SendBase=120
ACK=100
ACK=120

SendBase=120

lost ACK scenario premature timeout


Lecture 17:TCP reliable data transfer
TCP: retransmission
scenarios
Host A Host B

Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


ACK=100
timeo

X
ut

ACK=120

Seq=120, 15 bytes of data

cumulative ACK
Transport Layer 3-9
Lecture 17:TCP reliable data transfer
Modified TCP – Doubling Timeout
Interval
• Whenever the timeout event occurs, it sets the next
timeout interval to twice the previous value,
– rather than deriving it from the last EstimatedRTT and DevRTT
– However, in case of other two events (app data received or ACK
received), it is derived.

• It also provides a limited form of congestion control.


– Timer expiration due to congestion
– It is better to wait rather than keep sending
Lecture 17:TCP reliable data transfer

Modified TCP – Fast Retransmit

• Timeout-triggered retransmissions can take long


• Duplicate ACKs can help sender to detect packet loss

• A duplicate ACK is an ACK that reacknowledges a


segment for which the sender has already received an
earlier acknowledgment.

• When it is sent/received?
Lecture 17:TCP reliable data transfer
TCP ACK generation [RFC 1122,
RFC 2581]

event at receiver TCP receiver action


arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK

arrival of in-order segment with immediately send single cumulative


expected seq #. One other ACK, ACKing both in-order segments
segment has ACK pending

arrival of out-of-order segment immediately send duplicate ACK,


higher-than-expect seq. # . indicating seq. # of next expected byte
Gap detected

arrival of segment that immediate send ACK, provided that


partially or completely fills gap segment starts at lower end of gap
Lecture 17:TCP reliable data transfer

TCP fast retransmit

• time-out period often


TCP fast retransmit
relatively long:
– long delay before if sender receives 3
resending lost packet ACKs for same data
• detect lost segments via (“triple duplicate ACKs”),
duplicate ACKs. resend unacked
segment with
– sender often sends many smallest seq #
segments back-to-back  likely that unacked
– if segment is lost, there segment lost, so don’t
will likely be many wait for timeout
duplicate ACKs.

Transport Layer 3-13


Lecture 17:TCP reliable data transfer
TCP fast
retransmit
Host A Host B

Seq=92, 8 bytes of data


Seq=100, 20 bytes of data
X

ACK=100
ACK=100
timeo

ACK=100
ut

ACK=100
Seq=100, 20 bytes of data

fast retransmit after sender


receipt of triple duplicate ACK
Lecture 17:TCP reliable data transfer
TCP uses Go-Back-N or Selective
Repeat?
• Go-Back-N?
– TCP acknowledgments are cumulative
– TCP sender need only maintain SendBase
and NextSeqNum

• So? What do you say?


Lecture 17:TCP reliable data transfer
TCP uses Go-Back-N or Selective
Repeat?
• Selective Repeat?
– If n lost, only retransmit n
– Receiver would buffer out of order segments

• So? What do you say?


• It can be considered as an hybrid of both
Go-Back-N and Selective Repeat
Lecture 17:TCP reliable data transfer

Computer Networking: A Top Down Approach


6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

A note on the origin of these ppt slides:


These slides are freely provided by the book authors and it represents a lot of work on their part.
We would like to thank J.F Kurose and K.W. Ross.

You might also like