Transport Layer: Computer Networking: A Top Down Approach
Transport Layer: Computer Networking: A Top Down Approach
Transport Layer
Adapted by [email protected]
27 August 2019
Computer
They obviously represent a lot of work on our part. In return for use, we only
ask the following:
If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
Networking: A Top
If you post any slides on a www site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
Down Approach
material.
7th edition
Thanks and enjoy! JFK/KWR
Jim Kurose, Keith Ross
All material copyright 1996-2016 Pearson/Addison Wesley
J.F Kurose and K.W. Ross, All Rights Reserved April 2016
Transport Layer 2-1
Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 multiplexing and • segment structure
demultiplexing • reliable data transfer
3.3 connectionless • flow control
transport: UDP • connection management
3.4 principles of reliable 3.6 principles of congestion
data transfer control
3.7 TCP congestion control
Host B
Host A
Send Seq
SendBase=92 SendBase=50
SendBase=?
Transport Layer 3-5
TCP: seq. Nr, ACK - bidirectional
Host A has 8 bytes to send Host B has 5 bytes to send
92 93 94 95 96 97 98 99 100
Host B
Host A
Send Seq
SendBase=92 SendBase=50
50 51 52 53 54 55
Seq=92, 8 bytes of data,
ACK 50
Send Seq
Client Server
SendBase=42 SendBase=79
Client
types‘test’
Seq=42,
? ACK=79,
? data = ‘test’
Server ACKs
receipt of‘test’;
Echoes back ‘TEST’
Seq=79, ? data = ‘TEST’
? ACK=47,
IP
flow control code
receiver controls sender, so
sender won’t overflow
receiver’s buffer by transmitting from sender
too much, too fast
receiver protocol stack
data
checksum urg pointer
window size
acknowledgements: N
350
300
250
RTT (milliseconds)
200
sampleRTT
150
EstimatedRTT
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
time (seconds) Transport Layer 3-17
SampleRTT Estimated RTT
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)
Send Seq
Host A Host B
SendBase=92
Seq=92, 8 bytes of data
timeout
Seq=92, 8 bytes of data
timeout
ACK=100 ACK=100
X ACK=120
Seq=92, 8
ACKed=100 bytes of data
Seq=92, 8 bytes of data
ACKed=120
ACK=120
ACK=100 ACKed=120
ACK=100
Send Seq
X
ACK=120 100 101 102 103 104 … 119 120
Send Seq
Seq=120, 15 bytes of data
cumulative ACK
Transport Layer 3-21
TCP fast retransmit
time-out period often
relatively long: TCP fast retransmit
• long delay before if sender receives 3
resending lost packet ACKs for same data
detect lost segments (“triple duplicate ACKs”),
via duplicate ACKs. resend unacked
• sender often sends segment with smallest
many segments back- seq #
to-back
likely that unacked
• if segment is lost, there segment lost, so don’t
will likely be many wait for timeout
duplicate ACKs.
application application
network network
2-way handshake:
Q: will 2-way handshake
always work in
network?
Let’s talk
ESTAB unreliable channel
OK
ESTAB retransmitted messages (e.g.
req_conn(x)) due to loss
LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime
CLOSED
Why not 3-way closing?
Transport Layer 3-29
TCP segment structure
32 bits
As traffic increase:
❌ Delay increase
❌Packet loss Host B
maximum per-connection
throughput: R/2
delay
loss
Resolve congestion
lin R/2
large delays as arrival rate, lin,
approaches capacity
Transport Layer 3-33
Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 multiplexing and • segment structure
demultiplexing • reliable data transfer
3.3 connectionless • flow control
transport: UDP • connection management
3.4 principles of reliable 3.6 principles of congestion
data transfer control
3.7 TCP congestion control
Host A Host B
when connection begins,
increase rate
exponentially until first
loss event:
RTT
• initially cwnd = 1 MSS
• double cwnd every RTT
• done by incrementing
cwnd by 1 MSS (linear) for
every ACK received
summary: initial rate is
slow but ramps up
exponentially fast time
Implementation:
variable ssthresh
on loss event, ssthresh is set to 1/2 of cwnd
CA (Congestion Avoidance):
• when cwnd ≥ ssthresh, cwnd++ (add 1 MSS every RTT)
time
Transport Layer 3-37
TCP Congestion Control: details
sender sequence number space
cwnd TCP sending rate:
roughly: send cwnd
bytes, wait RTT for
last byte last byte
ACKS, then send
ACKed sent, not-
yet ACKed
sent more bytes
(“in-
flight”) cwnd
sender limits transmission: rate ~
~
RTT
bytes/sec
W/2