EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.
-
Upload
ilene-wilson -
Category
Documents
-
view
215 -
download
0
Transcript of EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.
![Page 1: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/1.jpg)
EE 122: Congestion Control and Avoidance
Kevin Lai
October 23, 2002
![Page 2: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/2.jpg)
Problem
At what rate do you send data? flow control
- make sure that the receiver can receive
- sliding-window based flow control:
• receiver reports window size to sender
• higher window higher throughput
• throughput = wnd/RTT
congestion control- make sure that the network can deliver
![Page 3: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/3.jpg)
Solutions
Everyone sends as fast as they can- excess gets dropped
- very bad idea: leads to congestion collapse
Reserve bandwidth- low utilization
- never have packet drops, queueing delays
Congestion control and avoidance- high utilization
- occasionally have packet drops, queueing delays
![Page 4: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/4.jpg)
Non-decreasing Efficiency under Load
Efficiency = useful_work/time
critical property of system design
- network technology, protocol or application
otherwise, system collapses exactly when most demand for its operation
trade lower overall efficiency for this?
LoadE
ffici
en
cy
knee
cliff
ok? good
![Page 5: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/5.jpg)
Congestion Collapse
Decrease of network efficiency under load- efficiency = utilization of bandwidth
Waste resources on useless or undelivered data Network layer
- loaddrops, 1 fragment dropped
Transport layer- retransmit too many times
- no congestion control / avoidance
![Page 6: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/6.jpg)
Transport Layer Congestion Collapse 1
network is congested (a router drops packets) the receiver didn’t get a packet sender waits, but not long enough
- timeout too short, retransmit again
- adds to congestion, increases likelihood that retransmission will be dropped, or delayed
rinse, repeat assume that everyone is doing the same network will become more and more congested
- with duplicate packets rather than new packets Solution: fix timeout (previous lecture)
![Page 7: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/7.jpg)
Transport LayerCongestion Collapse 2
Waste resources on undelivered data A flow sends data at a high rate despite loss Its packets consume bandwidth at earlier links, only
to be dropped at a later link
90% loss
bw wastedignores loss
Penalized
![Page 8: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/8.jpg)
Congestion Collapse and Efficiency
knee – point after which - throughput increases slowly- delay increases quickly
cliff – point after which- throughput decreases quickly
to zero (congestion collapse)- delay goes to infinity
Congestion avoidance- stay at knee
Congestion control- stay left of (but usually close
to) cliff
Load
Load
Th
rou
ghp
ut
De
lay
knee cliff
over utilization
under utilization
saturation
congestion collapse
![Page 9: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/9.jpg)
TCP Congestion Control
Operate to the left of the cliff- less efficient than operating at the knee, but requires
less support from network
Solution: Carefully manage number of packets in network
- starting up: increase number of packets allowed
- equilibrium: maintain constant number of packets
• must probe periodically for more available bandwidth
- congestion: decrease number of packets allowed
![Page 10: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/10.jpg)
TCP Congestion Control Components
Measure available bandwidth- slow start
• fast, hard on network- additive increase/multiplicative decrease
• slow, gentle on network Detecting congestion
- timeout based on RTT (last lecture)• robust, causes low throughput
- duplicate acks (Fast Retransmit)• can be fooled, maintains high throughput
Recovering from loss- Fast recovery: avoid slow start when few packets lost
![Page 11: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/11.jpg)
Congestion Window (cwnd)
Limits how much data can be in transit Integrate with flow control implemented as # of bytes, describe as # packets
EffectiveWindow = MaxWindow – (LastByteSent – LastByteAcked)
MaxWindow = min(cwnd, AdvertisedWindow)
LastByteAcked LastByteSent
sequence number increases
![Page 12: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/12.jpg)
12
Slow Start Goal
Goal: discover congestion quickly- used to get rough initial estimate of cwnd
Slow Start used when- a new connection, or
- after timeout, or
- after connection has been idle for a while
![Page 13: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/13.jpg)
Slow Start Algorithm
Algorithm:- Set cwnd =1
- Each time a segment is acknowledged increment cwnd by one (cwnd++)
Slow Start increases cwnd exponentially- called “Slow” because it gradually increases sending
rate according to the RTT
- predecessor just increased to advWin immediately
![Page 14: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/14.jpg)
Slow Start Example
cwnd doubles every RTT ACK for segment 1
segment 1cwnd = 1
cwnd = 2 segment 2segment 3
ACK for segments 2 + 3
cwnd = 4 segment 4segment 5segment 6segment 7
ACK for segments 4+5+6+7
cwnd = 8
![Page 15: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/15.jpg)
Slow Start Problem
Slow Start can cause serious loss- loss = bottleneck bandwidth * RTT
Example:- bottleneck link is 8 Mb/s
- RTT is 100ms
- at some point cwnd = 800,000 bits
• exactly right for bottleneck
- 100 ms late, cwnd = 1,600,000 bits
• twice the bottleneck, 800,000 bits lost (oops)
Need to switch to something else when throughput is close to bottleneck bandwidth
![Page 16: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/16.jpg)
Exiting Slow Start
cwnd>=advWin- limited by receiver’s advertised window if cwnd
allowed to increase, would grow unbounded
congestion- reached available bandwidth switch to AI/MD
cwnd>=ssthresh- ssthresh: slow start threshold
- ssthresh is a hint about when to slow down, calculated from previous congestion on same connection
- “we experienced congestion beyond this point before, slow down”
![Page 17: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/17.jpg)
17
Additive Increase/Multiplicative Decrease
Used Slow Start to get rough estimate of cwnd Goal: maintain operating point at the left of the
cliff- Additive increase: starting from the rough estimate,
slowly increase cwnd to probe for additional available bandwidth
- Multiplicative decrease: cut congestion window size aggressively if congestion occurs
Why not AI/AD, MI/MD, MI/AD:- mathematical models show A/M is only choice that
converges to fairness and efficiency
![Page 18: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/18.jpg)
AI/MD Algorithm
ssthresh = a segment is acknowledged
- increment cwnd by 1/cwnd (cwnd += 1/cwnd)
- as a result, cwnd is increased by one only if all segments in a cwnd have been acknowledged.
congestion detected- timeout: ssthresh = cwnd/2; cwnd = 1; begin slow start
- duplicate acks (Fast Retransmit): later
![Page 19: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/19.jpg)
Slow Start/AI/MD Example
Assume that ssthresh = 8
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 8
cwnd = 9
cwnd = 10
0
2
4
6
8
10
12
14
t=0
t=2
t=4
t=6
Roundtrip times
Cw
nd (
in s
egm
ents
)
ssthresh
![Page 20: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/20.jpg)
20
The big picture
Time
cwnd
Timeout
SlowStart
AI/MD
ssthresh
Timeout
SlowStart
SlowStart
AI/MD
![Page 21: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/21.jpg)
21
Slow Start/AI/MD Pseudocode
Initially:cwnd = 1;ssthresh = infinite;
New ack received:if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1;else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout:/* Multiplicative decrease */ssthresh = win/2;cwnd = 1;
![Page 22: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/22.jpg)
AI/MD Problem
If available bandwidth increases suddenly- e.g., other flows finish, route changes
then AI/MD will be slow to use it Without help from network, there is a
fundamental tradeoff between- being able to take available bandwidth and
- causing loss
![Page 23: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/23.jpg)
Congestion Detection
Wait for Retransmission Time Out (RTO)- RTO kills throughput
In BSD TCP implementations, RTO is usually more than 500ms
- the granularity of RTT estimate is 500 ms
- retransmission timeout is RTT + 4 * mean_deviation
Solution: Don’t wait for RTO to expire
![Page 24: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/24.jpg)
Fast Retransmit
Resend a segment after 3 duplicate ACKs
- a duplicate ACK means that an out-of sequence segment was received
Notes: - packet reordering can
cause duplicate ACKs- window may be too
small to get enough duplicate ACKs
ACK 2
segment 1cwnd = 1
cwnd = 2 segment 2segment 3
ACK 4cwnd = 4 segment 4
segment 5segment 6segment 7
ACK 3
3 duplicateACKs ACK 4
ACK 4
ACK 4
![Page 25: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/25.jpg)
Fast Recovery: After a Fast Retransmit
ssthresh = cwnd / 2 cwnd = ssthresh
- instead of setting cwnd to 1, cut cwnd in half (multiplicative decrease)
for each dup ack arrival- dupack++- MaxWindow = min(cwnd + dupack, AdvWin) - indicates packet left network, so we may be able to send more
receive ack for new data (beyond initial dup ack)- dupack = 0- exit fast recovery
But when RTO expires still do cwnd = 1
![Page 26: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/26.jpg)
Fast Recovery Problem
Can’t recover when more than half the window size is lost
- cwnd is cut in half
- MaxWindow is only increased when dup ack is received
- if more than half the window is lost, less than cwnd/2 dup acks will be received by sender
- sender will not be able to send anything, must wait for timeout
more than half the window lost indicates serious congestion anyway
![Page 27: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/27.jpg)
27
Fast Retransmit and Fast Recovery
Retransmit after 3 duplicated acks- Prevent expensive timeouts
Reduce slow starts At steady state, cwnd oscillates around the
optimal window size
Time
cwnd
Slow Start
AI/MD
Fast retransmit
![Page 28: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/28.jpg)
Other TCP-related techniques
TCP SACK- instead of cumulative acknowledgements, receiver tells
sender exactly what was lost
- useful when more than one packet lost in a window
Router support- have higher utilization, more fairness with router
support
![Page 29: EE 122: Congestion Control and Avoidance Kevin Lai October 23, 2002.](https://reader035.fdocuments.us/reader035/viewer/2022062422/56649f075503460f94c1cfad/html5/thumbnails/29.jpg)
TCP Congestion Control Summary
Measure available bandwidth- slow start
• fast, hard on network- additive increase/multiplicative decrease
• slow, gentle on network Detecting congestion
- timeout based on RTT • robust, causes low throughput
- Fast Retransmit• can be fooled, maintains high throughput
Recovering from loss- Fast recovery: avoid timeout when few packets lost