kameswari chebrolu dept. of electrical engineering, iit kanpur
TRANSCRIPT
![Page 1: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/1.jpg)
Transport Protocols
Kameswari ChebroluDept. of Electrical Engineering, IIT Kanpur
![Page 2: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/2.jpg)
EndtoEnd Protocols● Convert hosttohost packet delivery service into
a processtoprocess communication channel– Demultiplexing: Multiple applications can share the
network● End points identified by ports
– Ports are not interpreted globally– servers have well defined ports (look at /etc/services)
![Page 3: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/3.jpg)
Application Layer Expectations● Guaranteed message delivery● Ordered delivery● No duplication● Support arbitrarily large messages● Synchronization between the sender and receiver● Support flow control● Support demultiplexing
![Page 4: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/4.jpg)
Limitations of Networks
● Packet Losses● Reordering● Duplicate copies ● Limit on maximum message size● Long delays
![Page 5: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/5.jpg)
User Datagram Protocol (UDP)
SrcPort DstPort
ChecksumLength
Data
0 16 31Applicationprocess
Applicationprocess
Applicationprocess
UDP
Packets arrive
Ports
Queues
Packetsdemultiplexed
DemultiplexingUDP Header
Computes checksum over UDP header, message body and pseudoheader
![Page 6: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/6.jpg)
Transmission Control Protocol (TCP)● Connection oriented
– Maintains state to provide reliable service● Bytestream oriented
– Handles byte streams instead of messages● Full Duplex
– Supports flow of data in each direction● Flowcontrol
– Prevents sender from overrunning the receiver● Congestioncontrol
– Prevents sender from overloading the network
![Page 7: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/7.jpg)
TCP Cont...
Application process
Write bytes
TCP
Send buffer
Segment Segment Segment
Transmit segments
Application process
Read bytes
TCP
Receive buffer
■■■
![Page 8: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/8.jpg)
TCP Header Format
Options (variable)
Data
Checksum
SrcPort DstPort
HdrLen 0 Flags
UrgPtr
AdvertisedWindow
SequenceNum
Acknowledgment
0 4 10 16 31
Sender
Data (SequenceNum)
Acknowledgment +AdvertisedWindow
Receiver
![Page 9: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/9.jpg)
Connection EstablishmentActive participant
(client) (server)
SYN, SequenceNum = x
ACK, Acknowledgment =y+1
Acknowledgment =x+1SYN+ACK, SequenceNum=y,
![Page 10: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/10.jpg)
State Transition Diagram
![Page 11: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/11.jpg)
Sliding Window: Data Link vs Transport
P2P: End points can be engineered to support the link TCP: Any kind of computer can be connected to the Internet➢ Need mechanism for each side to learn other side's resources (e.g. buffer space) Flow control
P2P: Not possible to unknowingly congest the linkTCP: No idea what links will be traversed, network capacity can dynamically vary due to competing traffic➢ Need mechanism to alter sending rate in response to network congestion – Congestion control
![Page 12: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/12.jpg)
Sliding Window: Data Link vs TransportP2P: Dedicated Link Physical Link connects the same two computersTCP: Connects two processes on any two machines in the Internet➢ Needs explicit connection establishment phase to exchange state
P2P: Fixed round trip transmission time (RTT)TCP: Potentially different and widely varying RTTs➢ Timeout mechanism has to be adaptive
P2P: No Reordering TCP: Scope for reordering due to arbitrary long delays➢ Need to be robust against old packets showing up suddenly
![Page 13: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/13.jpg)
Slow Start● Add a variable cwnd (congestion window)● At start, set cwnd=1● On each ack for new data, increase cwnd by 1● When sending, send the minimum of receiver's
advertised window or cwnd
![Page 14: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/14.jpg)
![Page 15: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/15.jpg)
Congestion Avoidance (Additive Increase, Multiplicative Decrease)
● On detecting congestion, set cwnd to half the window size (multiplicative decrease)
● On each ack of new data, increase cwnd by 1/cwnd (additive increase)
![Page 16: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/16.jpg)
Combining Slow Start and Congestion Avoidance
● Two variables cwnd and ssthresh● On time out, set ssthresh = cwnd/2; cwnd = 1● When new data is acked,
– If (cwnd < ssthresh) cwnd += 1;– Else cwnd += 1/cwnd;
![Page 17: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/17.jpg)
Congestion Window vs Time
Cwnd
Cwnd/2
SlowStart
Waiting forTimeout
Timeout
SlowStart
CongestionAvoidance
Time
![Page 18: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/18.jpg)
Fast Retransmit & Fast Recovery● Fast Retransmit: Retransmit packet at sender after
3 duplicate acks● Fast Recovery
– On 3rd dupack, retransmit packet, ssthresh = min (cwnd/2,2); cwnd = ssthresh+3
– Another dupack, cwnd = cwnd +1; transmit packet if allowed by cwnd
– On ack acknowledging new data, cwnd = ssthresh, invoke congestion avoidance (linear increase in cwnd now on)
![Page 19: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/19.jpg)
Saw Tooth Pattern (With fast retransmit and recovery)
60
20
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0
Time (seconds)
70
30
40
50
10
10.0
![Page 20: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/20.jpg)
Sliding Window RecapSending application
LastByteWrittenTCP
LastByteSentLastByteAcked
Receiving application
TCP LastByteRead
NextByteExpected LastByteRcvd
Sending Side:● LastByteAcked <= LastByteSent● LastByteSent <= LastByteWritten● Buffer bytes between LastByteAcked and LastByteWritten
Receiving Side:● LastByteRead <= NextByteExpected● NextByteExpected <= LastByteRcvd+1● Buffer bytes between LastByteRead and LastByteRcvd
![Page 21: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/21.jpg)
Flow & Congestion Control● Buffers are of finite size
– MaxSendBuffer and MaxRcvBuffer● Receiving side:
– LastByteRcvd – LastByteRead <= MaxRcvBuffer– AdvertisedWindow = MaxRcvBuffer – ((NextByteExpected – 1) –
LastByteRead)● Sending side:
– MaxWindow = min (cwnd, AdvertisedWindow)– EffectiveWindow = MaxWindow – (LastByteSent –
LastByteAcked)– LastByteWritten – LastByteAcked <= MaxSendBuffer– Persist when AdvertisedWindow is zero
![Page 22: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/22.jpg)
RTT Estimation: Original Algorithm● Measure SampleRTT for sequence/ack combo● EstimatedRTT = a*EstimatedRTT + (1a)*SampleRTT
– a is between 0.80.9– small a heavily influenced by temporary fluctuations– large a not quick to adapt to real changes
● Timeout = 2 * EstimatedRTT
![Page 23: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/23.jpg)
Jacobson/Karels Algorithm
● Incorrect estimation of RTT worsens congestion● Algorithm takes into account variance of RTTs
– If variance is small, EstimatedRTT can be trusted– If variance is large, timeout should not depend
heavily on EstimatedRTT
![Page 24: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/24.jpg)
Jacobson/Karels Algorithm Cont..● Difference = SampleRTT EstimatedRTT● EstimatedRTT = EstimatedRTT + ( d *
Difference)● Deviation = Deviation + d ( |Difference|
Deviation)), where d ~ 0.125● Timeout = u * EstimatedRTT + q * Deviation,
where u = 1 and q = 4● Exponential RTO backoff●
![Page 25: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/25.jpg)
Protection Against Wraparound● Wraparound occurs because sequence number
field is finite– 32 bit sequence number space
● Solution: Use time stamp option● Maximum Segment Lifetime (MSL) is 120 sec
Bandwidth Time until WraparoundT1 (1.5Mbps) 6.6 hrs
Ethernet (10Mbps) 57 minutesT3 (45 Mbps) 13 minutes
FDDI (100Mbps) 6 minutesSTS3 (155Mbps) 4 minutes
STS12 (622Mbps) 55 secondsSTS24 (1.2Gbps) 28 seconds
![Page 26: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/26.jpg)
Summary● Transport protocols essentially demultiplexing
functionality● Examples: UDP, TCP, RTP ● TCP is a reliable connectionoriented bytestream
protocol– Sliding window based– Provides flow and congestion control
![Page 27: Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur](https://reader031.vdocuments.mx/reader031/viewer/2022012517/6191264efb309f0ac42b81d6/html5/thumbnails/27.jpg)
Must Reads● D. Clark, "The Design Philosophy of the DARPA
Internet Protocols", SIGCOMM, Palo Alto, CA, Sept 1988, pp. 106114
● J. Saltzer, D. Reed, and D. Clark, "Endtoend Arguments in System Design". ACM Transactions on Computer Systems (TOCS), Vol. 2, No. 4, 1984, pp. 195206
● Van Jacobson, "Congestion Avoidance and Control", ACM SIGCOMM, 1988