Congestion Control: Networked Systems 3
Congestion Control: Networked Systems 3
Lecture Outline
Packets Delivered
Packets Sent
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
Source: PARC
Conservation of packets
Conservation of Packets
When in equilibrium at that capacity, send one packet for each acknowledgement received
Total number of packets in transit is constant
Automatically reduces sending rate as network gets congested and delivers packets more slowly
AIMD Algorithms
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 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
Acknowledge each packet, only send new data when an acknowledgement received Adjust size of window, based on AIMD rules
Modern TCP also has ECN bits, but not widely used
Plus slow start and congestion avoidance Gives an approximately equal share of the bandwidth to each flow sharing a link The worlds most baroque sliding-window protocol Lloyd Wood
10
Receiver
Slow start to estimate the bottleneck link capacity Congestion avoidance to probe for changes in capacity
12
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
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
14
Slow Start
15
Slow Start
Sender Receiver
Two packets generated per acknowledgement The window doubles on every round trip time until loss occurs Rapidly finds the correct window size for the path
16
Congestion Avoidance
E.g. is sharing a connection with other traffic, and that traffic stops, meaning the available capacity increases
17
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)
18
Responding to Congestion
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
19
Responding to Congestion
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
20
10 11 12 13 14 15 16 17 18 19 20 21 22 23
Time (RTT)
Slow start
Congestion avoidance
21
Too much traffic queued at an intermediate link " some packets dropped This is not always true:
22
TCP is not appropriate for all applications But need to be TCP Friendly:
23
Questions?
24