Chapter 6 Congestion Control and Resource Allocation 6.3 TCP Congestion Control Additive Increase/Multiplicative Decrease (AIMD) o Basic idea: repeatedly increase transmission rate until congestion occurs; reduce transmission rate when congestion occurs. o New state variable per connection: CongestionWindow CongestionWindow limits how much data source is allowed to have in transit in order to not cause congestion. MaxWindow = MIN(CongestionWindow, AdvertisedWindow) is the maximum number of unacked bytes allowed. EffeciveWindow = MaxWindow (LastByteSent LastByteAcked) o The AIMD algorithm Increase CongestionWindow by one MSS per RTT when all packets sent during the last RTT have been ACKed (additive increase) Divide CongestionWindow by two when a timeout occurs (multiplicative decrease) Source interprets timeouts as a sign of congestion CongestionWindow not allowed to fall below MSS In practice, CongestionWindow is incremented by a fraction of MSS when an ACK is received. Increment = MSS x (MSS/CongestionWindow) Slow Start o Slow start is used at the beginning of a connection to increase the congestion window rapidly. o The slow start algorithm: Begin with CongestionWindow = 1 MSS Double CongestionWindow each RTT Increment CongestionWindow by 1 MSS for each ACK
o Slow start is also used after a timeout occurs. Upon timeout: Threshold is set to 1/2 of CongestionWindow just before timeout. CongestionWindow set to 1 MSS. CongestionWindow grows exponentially to Threshold (slow start), then grows linearly (additive increase). Fast Retransmit and Fast Recovery o Fast retransmit Goal: trigger retransmission of a dropped packet sooner than the regular timeout mechanism. Trigger of retransmission: three duplicate ACKs Timeouts cannot be eliminated because There may not be enough packets in transit to cause 3 duplicate ACKs when the window size is small. A large number of packets may be lost. o Fast recovery: skip the slow start phase when fast retransmit detects a lost packet Threshold set to CongestionWindow/2. CongestionWindow set to Threshold, window grows linearly. Summary of TCP congestion control o When CongestionWindow is below Threshold, window grows exponentially. o When CongestionWindow is above Threshold, window grows linearly. o When timeout occurs, Threshold is set to CongestionWindow/2 and CongestionWindow is set to 1 MSS. o When a triple duplicate ACK occurs, Threshold is set to CongestionWindow/2 and CongestionWindow is set to Threshold. 6.4 Congestion-Avoidance Mechanisms Congestion avoidance o Predict when congestion is about to happen. o Reduce sending rate of source host before packets start being discarded.
Two congestion avoidance approaches o With router assistance: DECbit and RED. o Without router assistance: TCP Vegas. DECbit o Add a congestion bit to packet header. o Router actions Monitor average queue length over last busy + idle cycle, plus the current busy cycle. Set congestion bit if average queue length 1 when the packet arrives. A queue length of 1 maximizes throughput/delay. o End host actions Destination host echoes congestion bit back to source host. Source records the fraction of the last window s worth of packets that resulted in the congestion bit being set. If fraction < 50%, increase congestion window by 1 packet. If fraction 50%, decrease congestion window to 0.875 times previous value. A threshold of 50% maximizes throughput/delay. Random Early Detection (RED) o Implicit notification: router drops packets when congestion is imminent. Designed to be used in conjunction with TCP. o Early random drop: router drops each arriving packet with some drop probability whenever the queue length exceeds a threshold. o RED details Average queue length computation AvgLen = (1 - Weight) x AvgLen + Weight x SampleLen, 0<Weight<1. Queue length measured every time a packet arrives.
Two queue length thresholds If AvgLen MinThreshold, queue the packet. If MinThreshold < AvgLen < MaxThreshold, calculate probability P and drop the arriving packet with probability P. If MaxThreshold Computing probability P AvgLen, drop the arriving packet. TempP = MaxP x (AvgLen MinThreshold) /(MaxThreshold - MinThreshold). P = TempP/(1 count x Temp), count = number of newly arriving packets that have been queued since the last drop. o Using count in the calculation ensures a roughly even distribution of drops over time. RED provides fair resource allocation because the probability of dropping a particular flow s packets is roughly proportional to the share of the bandwidth the flow is currently getting at the router. TCP Vegas o Goal: maintain the right amount of extra data in the network. Extra data data that the source would not have transmitted had it been trying to match exactly the available bandwidth of the network. Too much extra data: long delays and congestion. Too little extra data: cannot respond rapidly enough to transient increases in the available network bandwidth. o The algorithm Define BaseRTT to be the RTT of a packet when the flow is not congested. BaseRTT is set to the minimum of all measured RTTs. Calculate expected throughput ExpectedRate = CongestionWindow/BaseRTT
6.2 Queuing Disciplines Calculates current sending rate, ActualRate, once per RTT. ActualRate = K/(t1-t2), where t1 is the time a packet is sent, t2 is the time the ACK is received, K is the number of bytes transmitted between t1 and t2. Set congestion window based on ActualRate and ExpectedRate. Diff = ExpectedRate ActualRate (Diff 0) If Diff < α, increase CongestionWindow linearly during next RTT. If Diff > β, decrease CongestionWindow linearly during next RTT. If α < Diff < β, leave CongestionWindow unchanged. Use multiplicative decrease when a timeout occurs. Router implements queuing discipline that consists of o Scheduling discipline: determine the order in which packets are transmitted. (allocate link bandwidth) o Drop policy: determine which packets get discarded. (allocate buffer space) FIFO Queuing o The packets are transmitted in the order they arrive. o Tail drop. Priority Queuing - a variation of FIFO Queuing o Each packet is marked with a priority. o Routers implement one FIFO queue for each priority class. o Queues are serviced in strict order of queue priority. o Starvation problem. Fair Queuing (FQ) o Maintain a separate queue for each flow, queues serviced in roundrobin. Segregate traffic so that an ill-behaved source does not interfere with well-behaved sources.
o Approximate bit-by-bit round robin to fairly allocate link bandwidth. Imagine a clock that ticks once each time a bit is transmitted from all of the active flows. For a single flow Let P i denote the length of packet i. Let S i denote the time when the router starts to transmit packet i. Let F i denote the time when the router finishes transmitting packet i. Let A i denote the time when packet i arrives at the router. F i = S i +P i and S i = MAX (F i-1, A i ), so F i = MAX (F i-1, A i ) + P i. For multiple flows For each flow, calculate F i for each packet. Treat all F i s as timestamps, next packet to transmit is one with lowest timestamp. Not perfect: can t preempt a packet that is currently being transmitted. o Properties of FQ Work-conserving: the link is never left idle as long as there is at least one packet in the queue. Fair bandwidth allocation: when there are n flows, each flow gets 1/n th of the link bandwidth. Weighted Fair Queuing (WFQ) - a variation of FQ o A weight is assigned to each flow (queue) Weight specifies how many bits to transmit each time the router services that queue o Bandwidth received by a flow depends on its weight and the number of flows that are sharing the link. o If packet i belongs to a flow with weight w, then F i = MAX (F i-1, A i ) + P i /w