Transport Control Protocol: Outline
Transport Control Protocol: Outline
Transport Control Protocol: Outline
Outline
TCP objectives revisited TCP basics New algorithms for RTO calculation
CS 640
TCP Overview
TCP is the most widely used Internet protocol
Web, Peer-to-peer, FTP, telnet,
Closely tied to the Internet Protocol (IP) A focus of intense study for many years
Our goal is to understand the RENO version of TCP
RENO is most widely used TCP today RFC 2001 (now expired) RENO mainly specifies mechanisms for dealing with congestion
CS 640 2
TCP Features
Connection-oriented Byte-stream
app writes bytes TCP sends segments app reads bytes
Full duplex Flow control: keep sender from overrunning receiver Congestion control: keep sender from overrunning network
Application process Read bytes
Segment
Segment
Segment
Transmit segments
CS 640
Segment Format
0 4 10 SrcPort SequenceNum Acknowledgment HdrLen 0 Checksum Options (v ariable) Data Flags Adv ertisedWindow UrgPtr 16 DstPort 31
CS 640
Flags
Sequence Numbers
32 bit sequence numbers
Wrap around supported
TCP breaks byte stream from application into packets (limited by Max. Segment Size) Each byte in the data stream is considered Each packet has a sequence number
Initial number selected at connection time Subsequent numbers indicate first data byte number in packet
Connection Establishment
Active participant (client) Passive participant (server)
CS 640
Connection Termination
Active participant (server) Passive participant (client)
CS 640
SYN_RCVD
SYN_SENT
Close/FIN
ESTABLISHED
FIN/ACK
CS 640
10
Reliability in TCP
Checksum used to detect bit level errors Sequence numbers used to detect sequencing errors
Duplicates are ignored Reordered packets are reordered (or dropped) Lost packets are retransmitted
TCP
LastByteAcked
LastByteSent
NextByteExpected
LastByteRcvd
Sending side
LastByteAcked < = LastByteSent LastByteSent < = LastByteWritten buffer bytes between LastByteAcked and LastByteWritten
Receiving side
LastByteRead < NextByteExpected NextByteExpected < = LastByteRcvd +1 buffer bytes between NextByteRead and LastByteRcvd
CS 640 12
Sending side
LastByteSent - LastByteAcked < = AdvertisedWindow EffectiveWindow = AdvertisedWindow - (LastByteSent LastByteAcked) LastByteWritten - LastByteAcked < = MaxSendBuffer block sender if (LastByteWritten - LastByteAcked) + y > MaxSenderBuffer
Always send ACK in response to arriving data segment Persist sending one byte seg. when AdvertisedWindow = 0
CS 640 13
After each retransmission, set next RTO to be double the value of the last
Exponential backoff is well known control theory method Loss is most likely caused by congestion so be careful
16
New algorithm calculates both variance and mean for RTT Diff = sampleRTT - EstRTT EstRTT = EstRTT + ( d x Diff) Dev = Dev + d ( |Diff| - Dev) Initially settings for EstRTT and Dev will be given to you
where d is a factor between 0 and 1 typical value is 0.125
CS 640 17
When variance is small, TimeOut is close to EstRTT When variance is large Dev dominates the calculation Another benefit of this mechanism is that it is very efficient to implement in code (does not require floating point) Notes
algorithm only as good as granularity of clock (500ms on Unix) accurate timeout mechanism important to congestion control (later)
These issues have been studied and dealt with in new RFCs for RTO calculation. TCP RENO uses Jacobson/Karels
CS 640 18