CS 356: Computer Network Architectures Lecture 19: Congestion Avoidance Chap. 6.4 and related papers Xiaowei Yang xwy@cs.duke.edu
Overview • More on TCP congestion control – Theory – Macroscopic behavior – TCP Cubic • Queuing mechanisms – DropTail – Weighted fair queuing – Deficit round robin • Congestion Avoidance – Random Early Detection (RED) – Explicit Congestion Notification 2
Administrivia • Midterm summary – Will discussion solutions in next lecture – Return exams
Two Modes of Congestion Control 1. Probing for the available bandwidth – slow start (cwnd < ssthresh) 2. Avoid overloading the network – congestion avoidance (cwnd >= ssthresh)
Slow Start • Initial value: Set cwnd = 1 MSS • Modern TCP implementation may set initial cwnd to 2 • When receiving an ACK, cwnd+= 1 MSS • If an ACK acknowledges two segments, cwnd is still increased by only 1 segment. • Even if ACK acknowledges a segment that is smaller than MSS bytes long, cwnd is increased by 1. • Question: how can you accelerate your TCP download?
Congestion Avoidance • If cwnd >= ssthresh then each time an ACK is received, increment cwnd as follows: • cwnd += MSS * (MSS / cwnd) (cwnd measured in bytes) • So cwnd is increased by one MSS only if all cwnd /MSS segments have been acknowledged.
The Sawtooth behavior of TCP Cwnd RTT • For every ACK received – Cwnd += 1/cwnd *MSS • For every packet lost – Cwnd /= 2 7
Why does it work? [Chiu-Jain] – A feedback control system – The network uses feedback y to adjust users’ load å x_i 8
Goals of Congestion Avoidance – Efficiency: the closeness of the total load on the resource ot its knee – Fairness: • When all x_i’s are equal, F(x) = 1 • When all x_i’s are zero but x_j = 1, F(x) = 1/n – Distributedness • A centralized scheme requires complete knowledge of the state of the system – Convergence • The system approach the goal state from any starting state 9
Metrics to measure convergence • Responsiveness • Smoothness 10
Model the system as a linear control system • Four sample types of controls • AIAD, AIMD, MIAD, MIMD 11
Phase plot x 2 12 x 1
TCP congestion control is AIMD Cwnd RTT • Problems: – Each source has to probe for its bandwidth – Congestion occurs first before TCP backs off – Unfair: long RTT flows obtain smaller bandwidth shares 13
Macroscopic behavior of TCP • Throughput is inversely proportional to RTT: • 1 . 5 MSS • RTT p • In a steady state, total packets sent in one sawtooth cycle: – S = w + (w+1) + … (w+w) = 3/2 w 2 • the maximum window size is determined by the loss rate – 1/S = p 1 – w = 1.5 p • The length of one cycle: w * RTT • Average throughput: 3/2 w * MSS / RTT 14
TCP Cubic • CUBIC: a new TCP-friendly high-speed TCP variant by S. HaNorth, I. Rhee, and L. Xu • Implemented in Linux kernel and Windows 10
Overview • More on TCP congestion control – Theory – Macroscopic behavior – TCP Cubic • Queuing mechanisms – DropTail – Weighted fair queuing – Deficit round robin • Congestion Avoidance – Random Early Detection (RED) – Explicit Congestion Notification 16
Design Space for resource allocation • Router-based vs. Host-based • Reservation-based vs. Feedback-based • Window-based vs. Rate-based
Overview • More on TCP congestion control – Theory – Macroscopic behavior – TCP Cubic • Queuing mechanisms – DropTail – Weighted fair queuing – Deficit round robin • Congestion Avoidance – Random Early Detection (RED) – Explicit Congestion Notification 18
Queuing mechanisms • Router-enforced resource allocation • Default – First come first serve (FIFO)
Properties of Fair Queuing • Work conserving – Link busy if there is traffic to send • Max-min fair – Cannot increase without decreasing any flow with a no-greater share
Weighted Fair Queuing w=1 w=2 • Different queues get different weights – Take w i amount of bits from a queue in each round – F i = S i + P i / w i
Deficit Round Robin (DRR) • WFQ: extracting min is O(log Q) • DRR: O(1) rather than O(log Q) – Each queue is allowed to send Q bytes per round – If Q bytes are not sent (because packet is too large) deficit counter of queue keeps track of unused portion – If queue is empty, deficit counter is reset to 0 – Similar behavior as FQ but computationally simpler
• Unused quantum saved for the next round • How to set quantum size? – Too small – Too large
Congestion Avoidance Slow down before packet loss happens
Design goals • Predict when congestion is going to happen • Reduce sending rate before buffer overflows • Not widely deployed – Reducing queuing delay and packet loss are not essential
Mechanisms • Router+host joint control – Router: Early signaling of congestion – Host: react to congestion signals – Case studies: DECbit, Random Early Detection • Host: Source-based congestion avoidance – Host detects early congestion – Case study: TCP Vegas
DECbit • Add a congestion bit to a packet header • A router sets the bit if its average queue length is non-zero – Queue length is measured over a busy+idle interval • If less than 50% of packets in one window do not have the bit set – A host increases its congest window by 1 packet • Otherwise – Decreases by 0.875 • AIMD
Random Early Detection • Random early detection (Floyd93) – Goal: operate at the “knee” – Problem: very hard to tune (why) • RED is generalized by Active Queue Managment (AQM) • A router measures average queue length using exponential weighted averaging algorithm: – AvgLen = (1-Weight) * AvgLen + Weight * SampleQueueLen
RED algorithm p 1 avg_qlen min_thresh max_thresh • If AvgLen ≤ MinThreshold – Enqueue packet • If MinThreshold < AvgLen < MaxThreshold – Calculate dropping probability P – Drop the arriving packet with probability P • If MaxThreshold ≤ AvgLen – Drop the arriving packet
Even out packet drops TempP 1 avg_qlen min_thresh max_thresh • TempP = MaxP x (AvgLen – Min)/(Max-Min) • P = TempP / (1 – count * TempP) • Count – keeps track of how many newly arriving packets have been queued when min < Avglen < max • It keeps drop evenly distributed over time, even if packets arrive in burst
An example • MaxP = 0.02 • AvgLen is half way between min and max thresholds • TempP = 0.01 • A burst of 1000 packets arrive • With TempP, 10 packets may be discarded uniformly randomly among the 1000 packets • With P, they are likely to be more evently spaced out, as P gradually increases if previous packets are not discarded
Explicit Congestion Notification • A new IETF standard • Two bits in IP header – 00: No ECN support – 01/10: ECN enabled transport – 11: Congestion CE=1 experienced X ECE=1 • Two TCP flags – ECE: congestion CWR=1 experienced – CWR: cwnd reduced
Source-based congestion avoidance • TCP Vegas – Detect increases in queuing delay – Reduces sending rate • Details – Record baseRTT (minimum seen) – Compute ExpectedRate = cwnd/BaseRTT – Diff = ExpectedRate - ActualRate – When Diff < α , incr cwnd linearly, when Diff > β , decr cwnd linearly • α < β
cwnd
Summary • The problem of network resource allocation – Case studies • TCP congestion control • Fair queuing • Congestion avoidance – Active queue management – Source-based congestion avoidance
Recommend
More recommend