ACN_Week_8
ACN_Week_8
Transport-layer services
Multiplexing and demultiplexing
Connectionless transport: UDP
Principles of reliable data transfer
Connection-oriented transport: TCP
Principles of congestion control
TCP congestion control
Evolution of transport-layer
functionality
Transport Layer: 3-1
Principles of congestion control
Congestion:
informally: “too many sources sending too much data too fast for
network to handle”
manifestations:
• long delays (queueing in router buffers)
• packet loss (buffer overflow at routers)
different from flow control! congestion control:
a top-10 problem! too many senders,
sending too fast
Host B
R/2
Q: What happens as
lout
delay
arrival rate lin
throughput:
approaches R/2?
lin R/2 lin R/2
maximum per-connection large delays as arrival rate
throughput: R/2 lin approaches capacity
Transport Layer: 3-3
Causes/costs of congestion: scenario 2
one router, finite buffers
sender retransmits lost, timed-out packet
• application-layer input = application-layer output: lin = lout
• transport-layer input includes retransmissions : l’in lin
R R
lout
throughput:
Host A lin : original data lin
copy l'in: original data, plus lout R/2
retransmitted data
R R
no buffer space!
R R
lout
to retransmissions
full buffers
throughput:
when sending at
sender knows when packet has been dropped: R/2, some packets
only resends if packet known to be lost are needed
retransmissions
R R
lout
“wasted” capacity due
full buffers – requiring retransmissions to un-needed
retransmissions
but sender times can time out prematurely,
throughput:
sending two copies, both of which are delivered when sending at
R/2, some packets
are retransmissions,
including needed
and un-needed
Host A lin : original data lin
copy R/2 duplicates, that are
timeo
ut l'in: original data, plus delivered!
retransmitted data
R R
lout
“wasted” capacity due
full buffers – requiring retransmissions to un-needed
retransmissions
but sender times can time out prematurely,
throughput:
sending two copies, both of which are delivered when sending at
R/2, some packets
are retransmissions,
including needed
and un-needed
lin R/2 duplicates, that are
delivered!
“costs” of congestion:
more work (retransmission) for given receiver throughput
unneeded retransmissions: link carries multiple copies of a packet
• decreasing maximum achievable throughput
Host D
lout
Host C
lin’ R/2
Network-assisted congestion
control: explicit congestion info
routers provide direct feedback
to sending/receiving hosts with data data
ACKs
flows passing through congested ACKs
router
may indicate congestion level or
explicitly set sending rate
TCP ECN, ATM, DECbit protocols
Transport Layer: 3-14
Chapter 3: roadmap
Transport-layer services
Multiplexing and demultiplexing
Connectionless transport: UDP
Principles of reliable data transfer
Connection-oriented transport: TCP
Principles of congestion control
TCP congestion control
Evolution of transport-layer
functionality
Transport Layer: 3-15
TCP congestion control: AIMD
approach: senders can increase sending rate until packet loss
(congestion) occurs, then decrease sending rate on loss event
Additive Increase Multiplicative Decrease
increase sending rate by 1 cut sending rate in half at
maximum segment size every each loss event
RTT until loss detected
TCP sender Sending rate
AIMD sawtooth
behavior: probing
for bandwidth
Why AIMD?
AIMD – a distributed, asynchronous algorithm – has been
shown to:
• optimize congested flow rates network wide!
• have desirable stability properties
RTT
• initially cwnd = 1 MSS two segm
en ts
• double cwnd every RTT
• done by incrementing cwnd
for every ACK received four segm
ents
Implementation:
variable ssthresh
on loss event, ssthresh is set to
1/2 of cwnd just before loss event
* Check out the online interactive exercises for more examples: h ttp://gaia.cs.umass.edu/kurose_ross/interactive/
Transport Layer: 3-20
Summary: TCP congestion control
New
New ACK!
new ACK
duplicate ACK
dupACKcount++
ACK!
new ACK .
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
cwnd = cwnd+MSS transmit new segment(s), as allowed
dupACKcount = 0
L transmit new segment(s), as allowed
cwnd = 1 MSS
ssthresh = 64 KB cwnd > ssthresh
dupACKcount = 0
slow L congestion
start timeout avoidance
ssthresh = cwnd/2
cwnd = 1 MSS duplicate ACK
timeout dupACKcount = 0 dupACKcount++
ssthresh = cwnd/2 retransmit missing segment
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment
timeout
New
ACK!
ssthresh = cwnd/2
cwnd = 1 New ACK
dupACKcount = 0
cwnd = ssthresh dupACKcount == 3
dupACKcount == 3 retransmit missing segment dupACKcount = 0
ssthresh= cwnd/2 ssthresh= cwnd/2
cwnd = ssthresh + 3 cwnd = ssthresh + 3
retransmit missing segment
retransmit missing segment
fast
recovery
duplicate ACK
cwnd = cwnd + MSS
transmit new segment(s), as allowed
time
t0 t1 t2 t3 t4
Transport Layer: 3-23
TCP and the congested “bottleneck link”
TCP (classic, CUBIC) increase TCP’s sending rate until packet loss occurs
at some router’s output: the bottleneck link
source destination
application application
TCP TCP
network network
link link
physical physical
packet queue almost
never empty, sometimes
overflows packet (loss)
ECN=10 ECN=11
IP datagram
Transport Layer: 3-28
TCP fairness
Fairness goal: if K TCP sessions share same bottleneck link of
bandwidth R, each should have average rate of R/K
TCP connection 1
bottleneck
TCP connection 2 router
capacity R
Connection 1 throughput R
Transport Layer: 3-30
Fairness: must all network apps be “fair”?
Fairness and UDP Fairness, parallel TCP
multimedia apps often do not connections
use TCP application can open multiple
• do not want rate throttled by parallel connections between two
congestion control hosts
instead use UDP: web browsers do this , e.g., link of
• send audio/video at constant rate, rate R with 9 existing connections:
tolerate packet loss • new app asks for 1 TCP, gets rate R/10
there is no “Internet police” • new app asks for 11 TCPs, gets R/2
policing use of congestion
control
Network IP IP
TCP handshake
(transport layer) QUIC handshake
data
TLS handshake
(security)
data
HTTP HTTP
GET GET HTTP
application
GET
HTTP HTTP
GET GET
HTTP
GET QUIC QUIC QUIC QUIC QUIC QUIC
encrypt encrypt encrypt encrypt encrypt encrypt
QUIC QUIC QUIC QUIC QUIC QUIC
TLS encryption TLS encryption RDT RDT RDT RDT
error!
RDT RDT
if (y > SendBase) {
SendBase = y
/* SendBase–1: last cumulatively ACKed byte */
if (there are currently not-yet-acked segments)
start timer
else stop timer
}
Transport Layer: 3-42
TCP 3-way handshake FSM
closed
Socket connectionSocket =
welcomeSocket.accept();
L Socket clientSocket =
newSocket("hostname","port number");
SYN(x)
SYNACK(seq=y,ACKnum=x+1) SYN(seq=x)
create new socket for
communication back to client
listen
SYN
SYN sent
rcvd
SYNACK(seq=y,ACKnum=x+1)
ESTAB
ACK(ACKnum=y+1) ACK(ACKnum=y+1)
L
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
W/2
TCP over “long, fat pipes”
example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput
requires W = 83,333 in-flight segments
throughput in terms of segment loss probability, L [Mathis 1997]:
1.22 . MSS
TCP throughput =
RTT L
➜ to achieve 10 Gbps throughput, need a loss rate of L = 2·10-10 – a very
small loss rate!
versions of TCP for long, high-speed scenarios