Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size...
Transcript of Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size...
![Page 1: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/1.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017 | This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
Congestion Control
Networked Systems (H) Lecture 14
![Page 2: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/2.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Lecture Outline
• Congestion control principles
• Congestion control in the Internet • TCP congestion control
• Alternative approaches
2
![Page 3: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/3.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
What is Congestion Control?
• Adapting speed of transmission to match available end-to-end network capacity
• Preventing congestion collapse of a network
3
Packets Sent
Pac
kets
Del
iver
ed Maximum capacity
Congestion collapseNo useful work done
Occurred in the Internet in 1986, before congestion control added
![Page 4: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/4.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Network or Transport Layer?
• Can implement congestion control at either the network or the transport layer • Network layer – safe, ensures all transport protocols are congestion
controlled, requires all applications to use the same congestion control scheme
• Transport layer – flexible, transports protocols can optimise congestion control for applications, but a misbehaving transport can congest the network
4
![Page 5: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/5.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Congestion Control Principles
• Two key principles, first elucidated by Van Jacobson in 1988: [“Congestion Avoidance and Control”, Proc. ACM SIGCOMM’88] • Conservation of packets
• Additive increase/multiplicative decreasein sending rate
• Together, ensure stability of the network
5
Van Jacobson
Sou
rce:
PA
RC
![Page 6: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/6.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Conservation of Packets
• The network has a certain capacity • The bandwidth x delay product of the path
• When in equilibrium at that capacity, send one packet for each acknowledgement received • Total number of packets in transit is constant
• “ACK clocking” – each acknowledgement “clocks out” the next packet
• Automatically reduces sending rate as network gets congested and delivers packets more slowly
6
![Page 7: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/7.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
AIMD Algorithms
• Adjust sending rate according to an additive increase/multiplicative decrease algorithm • Start slowly, increase gradually to find equilibrium
• Add a small amount to the sending speed each time interval without loss
• For a window-based algorithm wi = wi-1 + α each RTT, where α = 1 typically
• Respond to congestion rapidly • Multiply sending window by some factor β < 1 each interval loss seen
• For a window-based algorithm wi = wi-1 × β each RTT, where β = 1/2 typically
• Faster reduction than increase → stability
7
![Page 8: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/8.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
How to Adapt Transmission?
• For sliding window protocols: • Acknowledge each packet, only send new data when an acknowledgement
received
• Adjust size of window, based on AIMD rules
• Other types of protocol should do something similar
8
![Page 9: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/9.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Congestion in the Internet
• Congestion control provided by transport layer • Dominant protocol is TCP
• Others try to be “TCP Friendly”
• Network layer signals congestion to transport • Packets discarded on congestion
• Note: implications for wireless Internet
• Modern TCP also has ECN bits, but not widely used
9
![Page 10: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/10.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
TCP Congestion Control
• TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance
• Gives approximately equal share of the bandwidth to each flow sharing a link
• The following slides give an outline of TCP Reno congestion control • The state of the art in TCP as of ~1990
• See RFC 7414 (https://tools.ietf.org/html/rfc7414) for a roadmap of current TCP specifications (57 pages, referencing ~150 other documents)
• “The world’s most baroque sliding-window protocol” – Lloyd Wood
10
![Page 11: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/11.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Sliding Window Protocols
• Consider a “stop and wait” protocol • Transmit a frame
• Await positive acknowledgement from receiver
• If no acknowledgement after some time out, retransmit frame
• Limits sender to one frame outstanding
Sender
Time
Receiver
Time
x
Transmit frame 1
Transmit frame 2
Time-out Retransmit frame 2
Transmit frame 3
Transmit frame 4
Acknowledge 1
Acknowledge 2
Acknowledge 3
11
![Page 12: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/12.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Link Utilisation
• Assume it takes time, ts, to serialise frame onto link • ts = (frame size) / (link bandwidth)
• Acknowledgement returns tRTT seconds later
• Utilisation, U = ts / tRTT • Desire link fully utilised: U ~ 1.0
• But U ≪ 1.0 for stop-and-wait protocol
Sender
Time
Receiver
Time
tstRTT
12
![Page 13: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/13.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
2019181716151413121110987
Sliding Window Protocol
Sender
Time
Receiver
Time
654321
Improve link utilisation by allowing several frames to be outstanding
13
![Page 14: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/14.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
2019181716151413121110987
Sliding Window Protocol
Sender
Time
Receiver
Time
654321
Improve link utilisation by allowing several frames to be outstanding
14
![Page 15: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/15.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
2019181716151413121110987
Sliding Window Protocol
Sender
Time
Receiver
Time
654321
Improve link utilisation by allowing several frames to be outstanding
15
Acknowledgement received window slides along one packet
![Page 16: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/16.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
2019181716151413121110987
Sliding Window Protocol
Sender
Time
Receiver
Time
654321
Improve link utilisation by allowing several frames to be outstanding
Acknowledgement received window slides along one packet
16
![Page 17: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/17.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
2019181716151413121110987
Sliding Window Protocol
Sender
Time
Receiver
Time
654321
Improve link utilisation by allowing several frames to be outstanding
Acknowledgement received window slides along one packet
Problem: how to size the window? Should be bandwidth x delay of the path, but neitherare known to the sender
17
![Page 18: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/18.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
TCP Congestion Control
• A sliding window protocol for TCP: • How to choose initial window?
• How to find the link capacity? • Slow start to estimate the bottleneck link capacity
• Congestion avoidance to probe for changes in capacity
18
![Page 19: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/19.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Choosing the Initial Window
• How to choose initial window size, Winit? • No information → need to measure path capacity
• Start with a small window, increase until congestion • Winit of one packet per round-trip time is the only safe option – equivalent to a stop-and-
wait protocol – but is usually overly pessimistic
• TCP uses a slightly larger initial window: Winit = min(4 × MSS, max(2 × MSS, 4380 bytes)) packets per RTT
• Example: an Ethernet with MTU of 1500 bytes, TCP/IP headers of 40 bytes → Winit = min(4 × 1460, max(2 × 1460, 4380)) = 4380 bytes = 3 packets per RTT
MSS = Maximum Segment Size (MTU minus TCP/IP header size)
19
![Page 20: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/20.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Finding the Link Capacity
• The initial window allows you to send
• How to choose the right window size to match the link capacity? Two issues: • How to find the correct window for the path when a new connection starts –
slow start
• How to adapt to changes in the available capacity once a connection is running – congestion avoidance
20
![Page 21: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/21.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Slow Start
• Initial window, Winit = 1 packet per RTT • Or similar… a “slow start” to the connection
• Need to rapidly increase to the correct value for the network • Each acknowledgement for new data increases the window by 1 packet per
RTT
• On packet loss, immediately stop increasing window
21
![Page 22: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/22.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Slow Start
Sender Receiver • Two packets for each acknowledgement
• The window doubles on every round trip time – until loss occurs
• Rapidly finds the correct window size for the path
22
![Page 23: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/23.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Congestion Avoidance
• Congestion avoidance mode used to probe for changes in network capacity • E.g., is sharing a connection with other traffic, and that traffic stops, meaning
the available capacity increases
• Window increased by 1 packet per RTT • Slow, additive increase in window: wi = wi-1 + 1
• Until congestion is observed → respond to loss
23
![Page 24: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/24.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Detecting Congestion
• TCP uses cumulative positive ACKs → two ways to detect congestion • Triple duplicate ACK → packet lost due to congestion
• ACKs stop arriving → no data reaching receiver; link has failed completely somewhere • How long to wait before assuming ACKs have stopped?
• Trto = max(1 second, average RTT + (4 x RTT variance)) • Statistical theory: 99.99% of data lies with 4σ of the mean, assuming normal distribution
(where variance of the distribution = σ2)
24
![Page 25: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/25.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Responding to Congestion
• If loss detected by triple-duplicate ACK: • Transient congestion, but data still being received
• Multiplicative decrease in window: wi = wi-1 × 0.5
• Rapid reduction in sending speed allows congestion to clear quickly, avoids congestion collapse
25
![Page 26: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/26.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Responding to Congestion
• If loss detected by time-out: • No packets received for a long period of time – likely a significant problem
with network (e.g., link failed)
• Return to initial sending window, and probe for the new capacity using slow start
• Assume the route has changed, and you know nothing about the new path
26
![Page 27: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/27.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Congestion Window Evolution
27
12345678910111213141516
00 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Con
gest
ion
Win
dow
(seg
men
ts)
Time (RTT)
Slow start Congestion avoidance
Typical evolution of TCP window, assuming Winit = 1
Converge on fair share of the path capacity
![Page 28: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/28.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
The Limitations of TCP
• TCP assumes loss is due to congestion • Too much traffic queued at an intermediate link → some packets dropped
• This is not always true: • Wireless networks
• High-speed long-distance optical networks
• Much research into improved versions of TCP for wireless links
28
![Page 29: Congestion ControlTCP Congestion Control • TCP is a sliding window protocol, measuring window size in bytes • Plus slow start and congestion avoidance • Gives approximately equal](https://reader035.fdocuments.in/reader035/viewer/2022062506/5f1b0c95f0f6c81f2405620c/html5/thumbnails/29.jpg)
Colin Perkins | https://csperkins.org/ | Copyright © 2017
Summary
• Congestion control principles • Conservation of packets
• Additive increase, multiplicative decrease (AIMD)
• TCP congestion control • Slow start
• Congestion avoidance
• AIMD
29