1 Chapter 3 Transport Layer Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved 3-1 Communication Networks P. Demeester Computer networking - A top-down approach featuring the internet 4th Edition, 2008 Addison Wesley James F. Kurose, Keith W. Ross ISBN 0-321-49770-8
61
Embed
1 Chapter 3 Transport Layer Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved 3-1 Communication Networks P. Demeester Computer.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Chapter 3Transport Layer
Part of slides provided by J.F Kurose and K.W. Ross, All Rights Reserved
3-1
Communication NetworksP. Demeester
Computer networking -A top-down approach featuring the internet4th Edition, 2008Addison WesleyJames F. Kurose, Keith W. RossISBN 0-321-49770-8
Transport Layer 3-2
Chapter 3: Transport Layer
Our goals: understand principles
behind transport layer services: multiplexing/
demultiplexing reliable data transfer flow control congestion control
learn about transport layer protocols in the Internet: UDP: connectionless
End-to-end, point-to-point, full-duplex byte-stream service over IP’s end-to-end packet delivery service
A connection-oriented protocol (handshake for initialization) over the connectionless IP protocol
Reliability (acknowledgment, retransmission, in sequence delivery, error control) over the unreliable IP protocol
Flow control end-to-end, without help from the network
Congestion control without help from the network
No guarantee on delay, delay variation, bandwidth like IP
Transport Layer 3-20
TCP: overview
TCP(+TCP send/
receive buffer)
IP
Send/ReceiveProcess
TCP(+TCP receive/
send buffer)
IP
Receive/Send Process
Packets
Segments
Byte stream
full-duplex, pt-pt, end-end
Transport Layer 3-21
Use of TCP
7 Echo Sends back what is received9 Discard Discards what is received13 Daytime Sends back the time of day20 FTP data Data channel for FTP21 FTP control Control channel for FTP (get, put, …)23 Telnet Default port for telnet application25 SMTP Used for sending email to a mailserver53 DNS Domain Name System over TCP80 HTTP Used in the World Wide Web109 POPv2 Used for reading email on a mailserver110 POPv3 Used for reading email on a mailserver111 SUN RPC Sun’s Remote Procedure Call over TCP119 NNTP Network News Transfer Protocol (newsgroups)143 IMAP Used for reading email on a mailserver161-162 SNMP Simple Network Management Protocol179 BGP Border Gateway Protocol194 IRC Internet Relay Chat, a chat service220 IMAPv3 Used for reading email on a mailserver515 Print Spooler Used in print servers666 Doom The popular 3D game by Id Software6000-6063 X11 The X Window System
Port Protocol Description
Transport Layer 3-22
16-bit source port number 16-bit destination port number32-bit sequence number
- ACK number indicates that all bytes before the ACK number have been received correctly- in practice : if a second segment is received, the accumulated ACK is send immediately
delayed
ACK
<ACK=185>
accumulated ACK
after 2 segments
Transport Layer 3-32
Avoid retransmission
Receiver side BSender side A
<ACK=145>timeoutretransm
it
<SEQ=165 (20)>
<SEQ=145 (20)>
<SEQ=145 (20)>
<ACK=185>
out of orderimmediate
ACK
missing segment arrived
accumulated ACK
start timerand
double RTO
not all segments have to be retransmitted !Les 5 6
Transport Layer 3-33
Fast retransmission
Receiver side BSender side A
<ACK=145>
<SEQ=165 (20)>
<SEQ=145 (20)>
<SEQ=145 (20)>
<ACK=225>
out of orderimmediate
ACK
missing segment arrived
accumulated ACK
<SEQ=185 (20)><SEQ=205 (20)>
<ACK=145>
<ACK=145>
retransmission much faster then timeout
timeoutNOT USED
3duplicate
dACK’s
=> fast retransm
it
Note : 3 dupl ack : make distinction with out of order
e.g. 1,3,4,2,5,6,...
Transport Layer 3-34
TCP ACK generation
Event at Receiver
Arrival of in-order segment withexpected seq #. All data up toexpected seq # already ACKed
Arrival of in-order segment withexpected seq #. One other segment has ACK pending
Arrival of out-of-order segmenthigher-than-expect seq. # .Gap detected
Arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK. Wait up to 500msfor 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 thatsegment starts at lower end of gap
Transport Layer 3-35
Retransmission timeoutProblem : large variation in round trip time !!! (LAN <> worldwide Internet)
==> dynamic update of retransmission timeout (RTO)[TimeoutInterval]
RTT = RTT + (1-) M (in general = 7/8)RTT (Round Trip Time) = exponential weighted moving average (EWMA) [EstimatedRTT] M = last measured time for an acknowledgment [SampleRTT]
Exponential back-off : every retransmission of the same segment will double the RTO (with an upper limit and latching of 64”)(connection timeout after preconfigured number of retransmissions)
(note : the RTT will not be updated based on the measurement of a retransmitted segment)
new value old value measured value
Transport Layer 3-36
Measured round trip time (M)
<SEQ=145 (20)>
<ACK=185>
<SEQ=165 (20)>
<SEQ=125 (20)>
<ACK=145>M #1
M #2
measured round trip time
Transport Layer 3-37
Chapter 3 outline
3.1 Transport-layer services
3.2 Multiplexing and demultiplexing
3.3 Connectionless transport: UDP
3.4 Principles of reliable data transfer
3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection
management
3.6 Principles of congestion control
3.7 TCP congestion control
Transport Layer 3-38
Flow control
Flow Control : receiver limits sender speedbased on own buffer filling
• slow receiver may not be able to cope with segmentstream from fast sender
• receiver will measure buffer filling• receiver will advertise to sender its free buffer space
(advertise receive window : RcvWindow)• sender will limit outgoing traffic• ONLY terminals participate in flow control (layer 4!)
Transport Layer 3-39
Flow control : receiver side
transport layer : TCP
receiver buffer (4 x MSS)
receiver
application layer
receive window = 2
segments delivered to application layer
segments receivedfrom senderreceive window = 4
Transport Layer 3-40
Flow control : sender sideapplication layer
transport layer : TCP
information from applicationready to send
sender
1 2 3 4 5 6 7 8 9
ACK=3, W=3
sent, not yet acknowledged
sent and acknowledged
send window = 4send window = 2send window = 3
send window = amount of data still allowed to send
Transport Layer 3-41
Flow control : example
1 2 3 4 5 6 7 8 9
data to be sent (expressed in MSS)
sender receiverreceiver buffer (4 x MSS)
<SYN>
<ACK, SYN, MSS=1,
Window=4>
<ACK>
<SEQ=1>
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
<SEQ=2>
<SEQ=3>
<SEQ=4>
2 MSS to application
<ACK=4, W=1>
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
<ACK=5, W=2>
receive window
send window
received not transferredto application
sent, not yet ack.
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9sent and
acknowledged
1 2 3 4 5 6 7 8 9
zero window <ACK=5, W=0> will stop communication (no more window updates) regular probing from sender (use persistency timer)
Transport Layer 3-42
Flow control : sliding window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<ACK=3, W=2>
<ACK=4, W=3>
SEND WINDOW = receive window (RcvWindow)
MINUS number of sent but not yet acknowledged bytes
(LastByteSent – LastByteAcked)
allowed to send if : LastByteSent – LastByteAcked < RcvWindow or SndWindow > 0
LastByteSentLastByteAcked
Transport Layer 3-43
Chapter 3 outline
3.1 Transport-layer services
3.2 Multiplexing and demultiplexing
3.3 Connectionless transport: UDP
3.4 Principles of reliable data transfer
3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection
management
3.6 Principles of congestion control
3.7 TCP congestion control
Transport Layer 3-44
Congestion <> Flow control
flow control : L4 buffers in hostscongestion control : L3 buffers in routers
Network layer : IP
Transport layer : TCP
sender receiver
buffer
!! Discarded !!
ROUTER
Transport layer : TCP
sender 2
sender 1 receiver 1
receiver 2
!! Discarded !!
Transport Layer 3-45
Impact of congestion
Effective throughput
Traffic offered to the network
Network congestion (layer 3): - limited capacity of routers (L3)- traffic load high
Solution : Congestion Control (in terminals)
layer 4 (TCP) will reduce load offered to L3 (IP)
Maximum capacityof the network
retransmissions: packet lossdue to buffer overflow
linear increase
congestion starts
Transport Layer 3-46
Approaches towards congestion control
End-end congestion control (TCP approach):
no explicit feedback from network
congestion inferred from end-system observed loss, delay
approach taken by TCP
Network-assisted congestion control:
routers provide feedback to end systems single bit indicating
congestion explicit rate sender
should send at
Two broad approaches towards congestion control:
Transport Layer 3-47
Chapter 3 outline
3.1 Transport-layer services
3.2 Multiplexing and demultiplexing
3.3 Connectionless transport: UDP
3.4 Principles of reliable data transfer
3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection
management
3.6 Principles of congestion control
3.7 TCP congestion control
Transport Layer 3-48
Congestion window : limit send rate
Flow control : detection by receiver and control by sender- receive window (set at receiver side)
Congestion control : detection and control by sender- congestion window (set at sender side)
MINUSnumber of sent but not yet acknowledged bytes
allowed to send if : LastByteSent – LastByteAcked < min {CongWindow, RcvWindow}
or SndWindow > 0
Transport Layer 3-49
Congestion window
- focus on the congestion window- suppose congestion window < receive window- congestion window multiple of MSS- expressed in bytes
receive window
congestion window
sent, not yet ack.
send window
sent and ack.
congestion window < receive window
congestion window > receive window
Transport Layer 3-50
Congestion detection (by sender !) Timeout :
• A segment or ACK was dropped due to congestion.• A segment or ACK is experiencing a large delay due to congestion. • A segment or ACK was dropped due to a transmission error
(has nothing to do with congestion and is assumed to be not important).
TCP solution : slow start + congestion avoidance
Duplicate acknowledgments (3 or more) :• One segment was dropped due to congestion.• Next segments still get through the network
(generating duplicate acknowledgments)
TCP solution : fast retransmission (see reliability) + fast
recovery
Transport Layer 3-51
Slow start
<SEQ=1(1)>
values expressed in MSS
<SEQ=2(1)>
<ACK=2>
<SEQ=3(1)>
<ACK=3>
<SEQ=4(1)><SEQ=5(1)><SEQ=6(1)><SEQ=7(1)><ACK=5>
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 8<SEQ=8(1)>
0
2
4
6
8
10
12
14
16
18
cwnd (# MSS)
0 1 2 3 4 5# RTT
<ACK=9>...
cwnd = 16
!!! value ofmeasured RTTis varying !!!
<ACK=4>
<ACK=6>
<ACK=7>
<ACK=8>
...
Transport Layer 3-52
Slow start threshold / Congestion avoidance
0
2
4
6
8
10
12
14
16
18
cwnd (# MSS)
0 1 2 3 4 5# RTT
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 8
cwnd = 9
cwnd = 10
SlowStart
Threshold(ssthresh)
slowstart
congestionavoidance
Transport Layer 3-53
Avoiding congestion (Timeout)
# RTT
cwdnsize
!!! TIMEOUT !!!ssthresh =
cwnd/2cwnd = 1 x MSS
Intial values : ssthresh = 64 kbyte
cwnd = 1xMSS
slow start
slow start
congestion avoidance
!!! TIMEOUT !!!ssthresh =
cwnd/2cwnd = 1 x MSS
Note : when cwnd > receive window==> normal flow control takes over