CSCI-1680 Transport Layer III Congestion Control Strikes Back
CSCI-1680 Transport Layer III Congestion Control Strikes Back
Rodrigo Fonseca
Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti, Ion Stoica
Last Time
• Flow Control
• Congestion Control
Today
• Flow Control:
– Receiver sets Advertised Window
• Congestion Control
– Two states: Slow Start (SS) and Congestion Avoidance
(CA)
– A window size threshold governs the state transition
• Window <= ssthresh: SS
• Window > ssthresh: Congestion Avoidance
– States differ in how they respond to ACKs
• Slow start: +1 w per RTT (Exponential increase)
• Congestion Avoidance: +1 MSS per RTT (Additive increase)
– On loss event: set ssthresh = w/2, w = 1, slow start
AIMD
Fair: A = B
AIMD
Flow Rate B
Efficient: A+B = C
Flow Rate A
States differ in how they respond to acks
cwnd
Timeout
Timeout
AIMD
AIMD
ssthresh
cwnd
AI/MD
Slow Start
Fast retransmit
Time
TCP Friendliness
• Can other protocols co-exist with TCP?
– E.g., if you want to write a video streaming app using
UDP, how to do congestion control?
10
9
RED
Throughput(Mbps)
8
1 UDP Flow at 10MBps
7
6
31 TCP Flows
5 Sharing a 10MBps link
4
3
2
1
0
1 4 7 10 13 16 19 22 25 28 31
Flow Number
TCP Friendliness
• Can other protocols co-exist with TCP?
– E.g., if you want to write a video streaming app using
UDP, how to do congestion control?
• Equation-based Congestion Control
– Instead of implementing TCP’s CC, estimate the rate
at which TCP would send. Function of what?
– RTT, MSS, Loss
• Measure RTT, Loss, send at that rate!
TCP Throughput
8
– Loss = 8/(3W2) ⇒ W = (4)
3⋅ Loss
• Equation-based
€ rate control can be TCP friendly and have better
properties, e.g., small jitter, fast ramp-up…
What Happens When Link is Lossy?
• Throughput ≈ 1 / sqrt(Loss)
p=0
60
50
40
p = 1%
30
20
p = 10%
10
0
1 26 51 76 101 126 151 176 201 226 251 276 301 326 351 376 401 426 451 476
What can we do about it?
Bytes in Flight
Throughput
Bytes in Flight
Tput =
InFlight/
RTTprop
Diagrams based on Cardwell et al., BBR: Congestion Based Congestion Control,”
Communications of the ACM, Vol. 60 No. 2, Pages 58-66.
Another view of Congestion Control
Round Trip Time
RTTprop
Bytes in Flight
Throughput
BDP Bottleneck BW
Bytes in Flight
Another view of Congestion Control
Round Trip Time
RTTprop
Bytes in Flight
Throughput
Bottleneck BW
RTTprop Loss-based CC
Bytes in Flight
Throughput
Bottleneck BW
From: https://labs.ripe.net/Members/gih/bbr-tcp
TCP Vegas
TCP Vegas
Idea: source
• Idea: watches
source for some
watches sign that
for sign that router’s
router’squeue
queueisisbuilding
buildingup
andup
congestion will happen—E.g.,
(e.g., sending rate flattens)RTT grows or sending rate flattens.
70
60
50
40
KB
30
20
10
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5
Time (seconds)
1100
Sending KBps
900
700
500
300
100
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5
Time (seconds)
Queue size in router
10
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5
Time (seconds)
TCP Vegas
• Compare Actual Rate (A) with Expected Rate (E)
6.4 Congestion-Avoidance Mechanisms 491
– If E-A > β, decrease cwnd linearly : A isn’t responding
– If E-A < α, increase cwnd linearly : Room for A to grow
70
60
50
40
KB
30
20
10
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
Time (seconds)
240
200
KBps
160
120
80
40
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
Time (seconds)
Vegas
Queue length
Instantaneous
Average
Time
• Computing probability P
- TempP = MaxP · (AvgLen MinThreshold)/(MaxThreshold
MinThreshold)
RED Drop Probability
- P = TempP/(1
• Define twocount · TempP)
thresholds: MinThresh, MaxThresh
• Drop• Probability Curve:
Drop probability:
P(drop)
1.0
MaxP
AvgLen
MinThresh MaxThresh
C y
x increases by 2 per RTT
y increases by 1 per RTT
Limit rates:
x = 2y
• 2.1Receiver:
TCP review
“upon receiving a
segment
While with ofNTCP's
a detailed description bytes, divide
error and congestion the
con-
Sender
Data 1
Receiver
trol mechanisms is beyond the scope of this paper, we describe the :1461
bytesof in
rudiments their M groups
behavior and
below to allow thoseacknowledge
unfamiliar with
TCP to understand the vulnerabilities explained later. For simplic-
each
ity, group
we consider TCP withoutseparately”
the Selective Acknowledgment op- RTT ACK 4
87
73
tion (SACK) [MMFR96], although the vulnerabilities we describe ACK 9
• alsoSender
exist when SACKwill grow window M times
is used.
TCP is a connection-oriented, reliable, ordered, byte-stream
ACK 1
461
faster
protocol with explicit flow control. A sending host divides the data
stream into individual segments, each of which is no longer than the
Data 1
Data 2
461:29
21
921:43
• Sender
Could
nection
Maximum Segment Size (SMSS) determined during con-
cause
establishment. Each growth
segment is labeledtowith4GB
explicit in
se- 4 Data 4
381:58
81
41
quence numbers to guarantee ordering and reliability. When a host
RTTs!
receives an in-sequence segment it sends a cumulative acknowl-
Data 5
841:73
01
edgment (ACK) in return, notifying the sender that all of the data
– M = N = 1460
preceding that segment' s sequence number has been received and
can be retired from the sender' s retransmission buffers. If an out-
of-sequence segment is received, then the receiver acknowledges
the next contiguous sequence number that was expected. If out- Figure 1: Sample time line for a ACK division attack. Th
standing data is not acknowledged for a period of time, the sender gins with cwnd=1, which is incremented for each of the three
will timeout and retransmit the unacknowledged segments. received. After one round-trip time, cwnd=4, instead of the ex
TCP uses several algorithms for congestion control, most no- of cwnd=2.
tably slow start and congestion avoidance [Jac88, Ste94, APS99].
Each of these algorithms controls the sending rate by manipulating This attack is demonstrated in Figure 1 with a time
TCP Daytona!
60000
Sequence number (Bytes)
40000
30000
20000
Data Segments
10000 ACKs
Data Segments (normal)
ACKs (normal)
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time (sec)
Figure 4: The TCP Daytona ACK division attack convinces the TCP F
Defense
D à Increases by 1 Increases by 5
A
22, 22 10, 35
(x, y)
Increases by 1
35, 10 15, 15
Increases by 5 Too aggressive
àLosses
Individual incentives: cheating pays àThroughput falls
Social incentives: better off without cheating
• Erasure coding
– Assume you can detect errors
– Code is designed to tolerate entire missing packets
• Collisions, noise, drops because of bit errors
– Forward error correction
• Examples: Reed-Solomon codes, LT Codes,
Raptor Codes
• Property:
– From K source frames, produce B > K encoded frames
– Receiver can reconstruct source with any K’ frames,
with K’ slightly larger than K
– Some codes can make B as large as needed, on the fly
LT Codes
Flow 1 1 2 3 4 5 6
(arrival traffic) time
Flow 2
1 2 3 4 5
(arrival traffic)
time
Service 1 2 3 4 5 6
1 2
in fluid flow 3 4 5 time
system
Packet 1 2 1 3 2 3 4 4 5 5 6
system time
Implementing FQ
• Suppose clock ticks with each bit transmitted
– (RR, among all active flows)
• Pi is the length of the packet
• Si is packet i’s start of transmission time
• Fi is packet i’s end of transmission time
• Fi = Si + Pi
• When does router start transmitting packet i?
– If arrived before Fi-1, Si = Fi-1
– If no current packet for this flow, start when packet
arrives (call this Ai): Si = Ai
• Thus, Fi = max(Fi-1,Ai) + Pi
Fair Queueing
10 2
9 1.8
RED FQ
Throughput(Mbps)
Throughput(Mbps)
8 1.6
7 1.4
6 1.2
5 1
4 0.8
3 0.6
2 0.4
1 0.2
0 0
1 4 7 10 13 16 19 22 25 28 31 1 4 7 10 13 16 19 22 25 28 31
Flow Number Flow Number
Big Picture