Computer Networks
Sina Keshvadi
Fall 2021
University of Calgary
Lecture No. 19
Oct 22, 2021
TCP Congestion Control
Transport Layer: 3-1
Today’s Agenda:
TCP slow start
Transport Layer: 3-2
Host A
one segment
Host B
RTT
time
two segments
four segments
TCP: from slow start to congestion avoidance
Transport Layer: 3-3
Implementation:
Q: when should the exponential increase switch to linear?
A: when cwnd gets to 1/2 of its value before timeout.
X
Congestion Avoidance
On entry to the congestion-avoidance state, the value of cwnd is approximately half its value when congestion was last encountered.
TCP adopts a more conservative approach and increases the value of cwnd by just a single MSS every RTT.
Transport Layer: 3-4
Fast Recovery
Transport Layer: 3-5
TCP: detecting, reacting to loss
Transport Layer: 3-6
With and Without Fast Recovery
Fast recovery is a recommended, but not required, component of TCP.
In both Tahoe and Reno, if an ACK times out (RTO timeout), slow start is used, and both algorithms reduce congestion window to 1 MSS.
3-7
TCP congestion control: AIMD
Transport Layer: 3-8
AIMD sawtooth
behavior: probing
for bandwidth
TCP sender Sending rate
time
increase sending rate by 1 maximum segment size every RTT until loss detected
Additive Increase
cut sending rate in half at each loss event
Multiplicative Decrease
TCP AIMD: more
Transport Layer: 3-9
Multiplicative decrease detail: sending rate is
Why AIMD?
Summary: TCP congestion control
Transport Layer: 3-10
timeout
ssthresh = cwnd/2
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment
Λ
cwnd > ssthresh
congestion
avoidance
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
transmit new segment(s), as allowed
new ACK
.
dupACKcount++
duplicate ACK
fast
recovery
cwnd = cwnd + MSS
transmit new segment(s), as allowed
duplicate ACK
ssthresh= cwnd/2
cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeout
ssthresh = cwnd/2
cwnd = 1
dupACKcount = 0
retransmit missing segment
ssthresh= cwnd/2
cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
cwnd = ssthresh
dupACKcount = 0
New ACK
slow
start
timeout
ssthresh = cwnd/2
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment
cwnd = cwnd+MSS
dupACKcount = 0
transmit new segment(s), as allowed
new ACK
dupACKcount++
duplicate ACK
Λ
cwnd = 1 MSS
ssthresh = 64 KB
dupACKcount = 0
New
ACK!
New
ACK!
New
ACK!
TCP congestion control: details
Transport Layer: 3-11
LastByteSent- LastByteAcked
<
cwnd
last byte
ACKed
last byte sent
cwnd
sender sequence number space
available but not used
TCP sending behavior:
TCP rate
~
~
cwnd
RTT
bytes/sec
sent, but not-yet ACKed
(“in-flight”)
TCP throughput
Transport Layer
3-12
W
W/2
avg TCP thruput =
3
4
W
RTT
bytes/sec
TCP Futures: TCP over “long, fat pipes”
➜ to achieve 10 Gbps throughput, need a loss rate of L = 2·10-10 – a very small loss rate!
Transport Layer
3-13
TCP throughput =
1.22
.
MSS
RTT
L
TCP CUBIC
Transport Layer: 3-14
Wmax
Wmax/2
classic TCP
TCP CUBIC - higher throughput in this example
TCP CUBIC
Transport Layer: 3-15
TCP
sending
rate
time
TCP Reno
TCP CUBIC
Wmax
t0
t1
t2
t3
t4
TCP and the congested “bottleneck link”
Transport Layer: 3-16
source
application
TCP
network
link
physical
destination
application
TCP
network
link
physical
bottleneck link (almost always busy)
packet queue almost never empty, sometimes overflows packet (loss)
TCP and the congested “bottleneck link”
Transport Layer: 3-17
source
application
TCP
network
link
physical
destination
application
TCP
network
link
physical
insight: increasing TCP sending rate will not increase end-end throughout with congested bottleneck
insight: increasing TCP sending rate will increase measured RTT
RTT
Goal: “keep the end-end pipe just full, but not fuller”
Delay-based TCP congestion control
Transport Layer: 3-18
Keeping sender-to-receiver pipe “just full enough, but no fuller”: keep bottleneck link busy transmitting, but avoid high delays/buffering
RTTmeasured
Delay-based approach:
if measured throughput “very close” to uncongested throughput
increase cwnd linearly /* since path not congested */
else if measured throughput “far below” uncongested throughout
decrease cwnd linearly /* since path is congested */
RTTmeasured
measured
throughput
=
# bytes sent in last RTT interval
Delay-based TCP congestion control
Transport Layer: 3-19
Explicit congestion notification (ECN)
Transport Layer: 3-20
source
application
TCP
network
link
physical
destination
application
TCP
network
link
physical
TCP deployments often implement network-assisted congestion control:
ECN=10
ECN=11
ECE=1
IP datagram
TCP ACK segment
TCP fairness
Transport Layer: 3-21
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
router
capacity R
TCP connection 2
Q: is TCP Fair?
Transport Layer: 3-22
Example: two competing TCP sessions:
R
R
equal bandwidth share
Connection 1 throughput
Connection 2 throughput
congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase
loss: decrease window by factor of 2
A: Yes, under idealized assumptions:
Is TCP fair?
Fairness: must all network apps be “fair”?
Transport Layer: 3-23
Fairness and UDP
Fairness, parallel TCP connections
Chapter 3: summary
Transport Layer: 3-24
Up next:
*************** NEW FALL 2020 ***************
Have a friend who forgot their CPSC password?
Know a classmate who still needs a CPSC account?
Tell them to skip the IT support queue and go direct to self-service!
1) Log into password.ucalgary.ca with IT account credentials
2) Under "Other Accounts", search for "Computer Science Account"
(Email scihelp@ucalgary.ca if a CPSC account is not listed)
3) Click "Change password" and follow the prompts
***********************************************
3-25
Transport layer: roadmap
Transport Layer: 3-26
Evolving transport-layer functionality
Transport Layer: 3-27
Scenario | Challenges |
Long, fat pipes (large data transfers) | Many packets “in flight”; loss shuts down pipeline |
Wireless networks | Loss due to noisy wireless links, mobility; TCP treat this as congestion loss |
Long-delay links | Extremely long RTTs |
Data center networks | Latency sensitive |
Background traffic flows | Low priority, “background” TCP flows |
QUIC: Quick UDP Internet Connections
Transport Layer: 3-28
IP
TCP
TLS
HTTP/2
IP
UDP
QUIC
HTTP/2 (slimmed)
Network
Transport
Application
HTTP/2 over TCP
HTTP/3
HTTP/2 over QUIC over UDP
QUIC: Quick UDP Internet Connections
Transport Layer: 3-29
adopts approaches we’ve studied in this chapter for connection establishment, error control, congestion control
QUIC: Connection establishment
Transport Layer: 3-30
TCP handshake
(transport layer)
TLS handshake
(security)
TCP (reliability, congestion control state) + TLS (authentication, crypto state)
data
QUIC handshake
data
QUIC: reliability, congestion control, authentication, crypto state
QUIC: streams: parallelism, no HOL blocking
Transport Layer: 3-31
(a) HTTP 1.1
TLS encryption
TCP RDT
TCP Cong. Contr.
transport
application
(b) HTTP/2 with QUIC: no HOL blocking
TCP RDT
TCP Cong. Contr.
TLS encryption
error!
HTTP
GET
HTTP
GET
HTTP
GET
QUIC Cong. Cont.
QUIC
encrypt
QUIC
RDT
QUIC
RDT
QUIC
RDT
QUIC
encrypt
QUIC
encrypt
UDP
UDP
QUIC Cong. Cont.
QUIC
encrypt
QUIC
RDT
QUIC
RDT
QUIC
RDT
QUIC
encrypt
QUIC
encrypt
error!
HTTP
GET
HTTP
GET
HTTP
GET