cs/ee 145a congestion control netlab.caltech.edu/course
TRANSCRIPT
CS/EE 145ACS/EE 145A Congestion Control Congestion Control
Netlab.caltech.edu/courseNetlab.caltech.edu/course
Congestion ControlCongestion Control
Why do we need congestion control?Why do we need congestion control? Design issuesDesign issues Implementation issuesImplementation issues Lab 4Lab 4
Why do we need congestion Why do we need congestion control?control?
Rate Based ControlRate Based ControlL(i): The set of links that connection i usesL(i): The set of links that connection i usesxxii: the sending rate of connection i: the sending rate of connection i
Otherwise…Otherwise…Persistent Packet LossPersistent Packet LossReceiver has to get a huge buffer for reassembReceiver has to get a huge buffer for reassemb
lyly
l
iLli cxl
:
L 2 K-> oo3 L L L 7 8
Window based controlWindow based control
~ W packets per RTT~ W packets per RTT
RTT
time
time
Source
Destination
1 2 W
1 2 W
1 2 W
data ACKs
1 2 W
sec)/( pktRTT
wT
w?
Window based controlWindow based control Ack ClockingAck Clocking
S R
Router:
C pkt/sec
Sender:
W packet per RTT
RTT=propagation delay + queueing delay
Receiver:
W~2W buffer
At time 0… CRTT
W
)0(
12345
Window based controlWindow based control Ack ClockingAck Clocking
S R
Router:
C pkt/sec
Sender:
W packet per RTT
RTT=propagation delay + queueing delay
Receiver:
W~2W buffer
Packets leave the router at C pkt/sec
12345W 678
Window based controlWindow based control Ack ClockingAck Clocking
S R
Router:
C pkt/sec
Sender:
W packet per RTT
RTT=propagation delay + queueing delay
Receiver:
W~2W buffer
Acknowledgment goes back at C pkt/sec
A1
A2
A3
A4
A5
AW
A6
A7
A8
Window based controlWindow based control Ack ClockingAck Clocking
S R
Router:
C pkt/sec
Sender: W packet per RTT
RTT=propagation delay + queueing delay
Receiver:
W~2W buffer
The sender sends one packet for each acknowledgement
New packets leaves the sender at C pkt/sec!
4 3 2 1
A5
AW
A6
A7
A8
Window based controlWindow based control Ack ClockingAck Clocking
S R
Router:
C pkt/sec
Sender: W packet per RTT
RTT=propagation delay + queueing delay
Receiver:
W~2W buffer
If the router has infinite buffer…
The window based control can have correct sending rate???
4 3 2 1
A5
AW
A6
A7
A8
If the router has infinite If the router has infinite buffer…buffer…
Not Really…Not Really…
1985: 1985: J. NagleJ. Nagle (RFC 970) (RFC 970)
S R12345W 678
Queueing delay Experienced by Packet i:Queueing delay Experienced by Packet i: 1986: 1986: Lixia ZhangLixia Zhang (Why TCP timers Don’t work well, (Why TCP timers Don’t work well, Sigcomm Sigcomm
8686))
cRTTW
iiq *)0(
We need congestion We need congestion controlcontrol
Because…Because… It is very difficult, if not impossible, It is very difficult, if not impossible,
to have accurate RTT measurement. to have accurate RTT measurement. Hence timeout cannot work well Hence timeout cannot work well with packet loss…with packet loss…
The router has finite bufferThe router has finite buffer
We need congestion We need congestion controlcontrol
Because…Because… It is very difficult, if not impossible, to haIt is very difficult, if not impossible, to ha
ve accurate RTT measurementve accurate RTT measurement Have better or more conservative RTT meHave better or more conservative RTT me
asurement to prevent congestion collapseasurement to prevent congestion collapse The router has finite bufferThe router has finite buffer Change the window (W) according to pacChange the window (W) according to pac
ket lossket loss--Van Jacobson (Sigcomm 88)--Van Jacobson (Sigcomm 88)
We need congestion We need congestion controlcontrol
Because…Because… It is very difficult, if not impossible, to It is very difficult, if not impossible, to
have accurate RTT measurementhave accurate RTT measurementHave better or more conservative RTT Have better or more conservative RTT
measurement to prevent congestion measurement to prevent congestion collapsecollapse
The router has finite bufferThe router has finite bufferChange the window (W) according to Change the window (W) according to
packet losspacket lossTons of papers afterward…Tons of papers afterward…
We need congestion We need congestion controlcontrol
2000: Sally Floyd: Goal of Congestion Con2000: Sally Floyd: Goal of Congestion Control (RFC 2914)trol (RFC 2914)
Preventing congestion collapse Preventing congestion collapse Fairness between different connectionsFairness between different connections Optimizing performance regarding throOptimizing performance regarding thro
ughput, delay, and loss. ughput, delay, and loss.
Stability as in control theoryStability as in control theory
Basic IdeasBasic Ideas
Basic IdeasBasic Ideas
Three Questions that a congestion contrThree Questions that a congestion control algorithm should answer:ol algorithm should answer:
How frequent to make decisionHow frequent to make decision Decision functionDecision function How to Increase/Decrease WindowHow to Increase/Decrease Window
--Raj Jain--Raj Jain
How Frequent?How Frequent?
Possible events…Possible events…
Per Packet Per Packet (acknowledgement)(acknowledgement)
Per RTT (window)Per RTT (window)
Per LossPer Loss
Per ConnectionPer Connection
Decision FunctionDecision Function
Decision FunctionDecision Function
Congestion SignalsCongestion Signals
Packet LossPacket Loss Queueing delayQueueing delay Explicit Congestion Notification Explicit Congestion Notification
(ECN)(ECN)
Congestion SignalCongestion Signal
Queueing delay
ECN
Loss
TFRCp=p*
DUALq>q_max/2?
Vegasq=q*
CARDq>0?
Goodput
Decision Decision FunctionFunction
using using Binary Signal Binary Signal
SimpleSimple NaturalNatural RobustRobust
OscillateOscillate Less Less
InformatioInformation?n?
Congestion SignalCongestion Signal
LossLoss DelayDelay ECNECN
Delay-Delay-BasedBased
Loss-BasedLoss-Based
Multi-Valued Multi-Valued SignalSignal
FAST / FAST / VegasVegas
TFRCTFRC
Binary SignalBinary Signal CARD / CARD / DUALDUAL
RenoReno / HST / HSTCP / ScalablCP / ScalableTCPeTCP
Increase / Decrease Increase / Decrease FunctionFunction
I/D Function (I): AIMDI/D Function (I): AIMD
0
100
200
300
400
500
0 1000 2000 3000 4000 5000 6000 7000Time (s)
Thr
ough
put
(Mb/
s)
?0,...),( lqF bww ?0,...),( lqF aw
AIMD: FairnessAIMD: Fairness
I/D Function (II): Equation I/D Function (II): Equation BasedBased
,...),,(* lqwFw )( * www
Equation Based Protocol: Equation Based Protocol: FairnessFairness
A Case Study: TCP Reno A Case Study: TCP Reno CACA
Decision Frequency: Decision Frequency:
each RTT and each Losseach RTT and each Loss Decision function: Decision function:
Loss=0 or Loss=1?Loss=0 or Loss=1? Increase / Decrease function: AIMDIncrease / Decrease function: AIMD
Loss=0: w=w+1 (a=1) each RTTLoss=0: w=w+1 (a=1) each RTT
Loss=1: w=w/2 (b=1/2) each RTTLoss=1: w=w/2 (b=1/2) each RTT
TCP Reno: Slow StartTCP Reno: Slow Start
When Window is too small: When Window is too small: Increase / Decrease function: Slow StartIncrease / Decrease function: Slow Start
Loss=0: w=w*2 each RTTLoss=0: w=w*2 each RTTLoss=1: w=w/2 (b=1/2) each RTTLoss=1: w=w/2 (b=1/2) each RTT
How do we know if the window is too smaHow do we know if the window is too small?ll?
Longer History is recorded by Longer History is recorded by SSThreshSSThresh:Initialization: Initialization: SSThreshSSThresh = oo = oo
Loss=1: Loss=1: SSThreshSSThresh =w/2 =w/2
ChallengesChallenges
Implementation: Implementation: MeasurementMeasurement
RealityReality
ll
Implementation: Implementation: MeasurementMeasurement
Loss DetectionLoss Detection
ACK;ACK;
Selective ACK;Selective ACK;
Control PacketControl Packet Round Trip Delay MeasurementRound Trip Delay Measurement
Sender side TimestampSender side Timestamp
On packet timestampOn packet timestamp
When one packet loss is When one packet loss is detecteddetected
Assume Assume All the packets sent but not acknowledged are lostAll the packets sent but not acknowledged are lost All the packets sent but not acknowledged are in flight All the packets sent but not acknowledged are in flight All the packets sent but not acknowledged are receivedAll the packets sent but not acknowledged are received
RTT
time
time
Source
Destination
1 2 W
2 W
1 2 W
ACK=1
Implementation: Implementation: MeasurementMeasurement
Noise Filters:Noise Filters: Exponential Weighted Moving Exponential Weighted Moving
AverageAverage
Variance MeasurementVariance Measurement
sss )1(
ssdd 1
Implementation: ControlImplementation: Control
RealityRealityww
Implementation: ControlImplementation: Control
How to enforce “one window of How to enforce “one window of packet” is sent each RTT?packet” is sent each RTT?
• If the window does not change and If the window does not change and there is no packet loss…there is no packet loss…
• If window changes and there is no If window changes and there is no loss…loss…
• If there is loss…If there is loss…
Implementation: Implementation: MeasurementMeasurement
RealityReality
ff
Implementation: ControlImplementation: Control
Measure the packets in flightMeasure the packets in flight• InitializationInitialization• When a packet is sentWhen a packet is sent• When an acknowledgement is When an acknowledgement is
receivedreceived• When a packet loss is detectedWhen a packet loss is detected Enforce the congestion control:Enforce the congestion control:
Packets in flight <= windowPackets in flight <= window
ImplementationImplementation
RealityReality
ff
RealityReality
ll
ww
Implementation: Implementation: Bottleneck in the ReceiverBottleneck in the Receiver
If we send w packets in one RTT, the If we send w packets in one RTT, the receiver side should have free buffer receiver side should have free buffer for at least w packets.for at least w packets.
What happen if the receiver has not What happen if the receiver has not enough buffer? “Advertised window” enough buffer? “Advertised window” from receiver.from receiver.
L 2 W3 4 5 6 7 8
}_,_min{ wndawndcw
Lab 4Lab 4
Finish our “big project”Finish our “big project” How to split a file into packets?How to split a file into packets? How to detect errors (packet corruption, How to detect errors (packet corruption,
packet loss, duplication, reordering…)?packet loss, duplication, reordering…)? How to recover from packets How to recover from packets
reordering?reordering? How to recover from loss?How to recover from loss? How to use the bandwidth efficiently?How to use the bandwidth efficiently? How to share the bandwidth fairly?How to share the bandwidth fairly? ……
Lab 4 - TaskLab 4 - Task
Design and implement a congestion Design and implement a congestion control mechanism based on the control mechanism based on the reliable transmission protocol in Lab 3reliable transmission protocol in Lab 3
• Choose the congestion signalsChoose the congestion signals• Design the response functionDesign the response function• Implement the algorithm Implement the algorithm
(measurement and control)(measurement and control)• Analyze your algorithm (equilibrium Analyze your algorithm (equilibrium
analysis and stability analysis)analysis and stability analysis)
Lab 4 - RequirementsLab 4 - Requirements
Clearly write down your designClearly write down your design How do you choose congestion How do you choose congestion
signalsignal How do you choose decision function How do you choose decision function
and increase / decrease functionand increase / decrease function How do you measure the inputsHow do you measure the inputs How do you control the rateHow do you control the rate
Etc…Etc…
Lab 4 - RequirementsLab 4 - Requirements
ImplementationImplementation Based on the codes of Lab 3Based on the codes of Lab 3 Maximize the goodputMaximize the goodput Achieve reasonable fairness when Achieve reasonable fairness when
sharing the same bottleneck with sharing the same bottleneck with other connections running the same other connections running the same protocolprotocol
Lab 4 - RequirementsLab 4 - Requirements
AnalysisAnalysis In what kind of environments does In what kind of environments does
your design work well?your design work well? Any possible environments that your Any possible environments that your
design does not work?design does not work? Is your protocol fair? Is your protocol fair? Is your protocol stable? Is your protocol stable?
Etc…Etc…
Lab 4 - Possible Lab 4 - Possible ProblemsProblems
Measurement of RTT and LossMeasurement of RTT and Loss Control the packets in flightControl the packets in flight Adapt to different environmentsAdapt to different environments Testing:Testing:
FreeBSD: DummynetFreeBSD: Dummynet
Linux: NISTLinux: NIST
Lab 4 - TipsLab 4 - Tips Refer to the Textbook and reference booksRefer to the Textbook and reference books Refer to RFCsRefer to RFCs• RFC 2581: TCP Congestion Control RFC 2581: TCP Congestion Control • RFC 2582: The New Reno Modification to TCP's FRFC 2582: The New Reno Modification to TCP's F
ast Recovery Algorithm ast Recovery Algorithm Refer to one or two classical papersRefer to one or two classical papers• Congestion Avoidance and ControlCongestion Avoidance and Control Van Jacobson,Van Jacobson,
Michael J. Karels; SIGCOMM 1988; LBL, UC Berkeley Michael J. Karels; SIGCOMM 1988; LBL, UC Berkeley • A Delay-Based Approach for Congestion AvoidA Delay-Based Approach for Congestion Avoid
ance in Interconnected Heterogeneous Compance in Interconnected Heterogeneous Computer Networksuter Networks Raj Jain, SICOMM 1988, Digital EquipRaj Jain, SICOMM 1988, Digital Equipment Corporationment Corporation
Re-Use the codes in Lab 3Re-Use the codes in Lab 3
Lab 4 Lab 4
Due: Dec 5Due: Dec 5thth (Friday) 23:59:59 (Friday) 23:59:59 Email: Email: [email protected]@caltech.edu GradingGrading• 50%: Design50%: Design• 30%: Implementation30%: Implementation• 20%: Analysis20%: Analysis TA hours: TA hours: Tue / Thu (20:00 – 22:00) JRG 170Tue / Thu (20:00 – 22:00) JRG 170