TCP Congestion Control Review Congestion Control (cont’d) Congestion control consists of 3 tasks Detect congestion Adjust sending rate Determine available bandwidth How does TCP do each of these? Packets vs. Bytes TCP Start Up TCP window sizes are in bytes How do we set initial window size? Congestion control works on packets Additive increase too slow Increase by 1 packet every RTT Example: DSL line Pcwnd = cwnd / MSS RTT=100ms, MSS=1500b, BW=200KB/s Pcwnd = Pcwnd + 1/Pcwnd on each ACK After 1 RTT, rate is 15 KB/s Multiply by MSS to get byte-sized formula After 1s, rate is 150 KB/s cwnd = cwnd + MSS*(MSS/cwnd) on each ACK Increase by 1 MSS every RTT Takes 8.3s to transfer 500 KB file Slow Start Window rate control Objective Congestion window ensures average Source Destination Determine initial available capacity rate is cwnd / RTT Idea Begin with CongestionWindow = 1 Instantaneous rate may be larger packet Double CongestionWindow each RTT Increment by 1 packet for each ACK window-controlled Continue increasing until loss, then switch to AIMD transmissions Result time Exponential growth … Slower than all at once rate-controlled 0 1 RTT 2 RTT transmissions 1
ACK clocking ACK clocking ACK clocking spreads out bursts ACK clocking spreads out bursts Packets sent in a burst arrive spread out Packets sent in a burst arrive spread out ACKs follow the timing of received rate ACKs follow the timing of received rate New sending rate follows ACK rate 100 Mbps 5 Mbps 100 Mbps 5 Mbps Sender Router Receiver Sender Router Receiver Slow start Slow start ACK clocking, with 2 packets per ACK ACK clocking, with 2 packets per ACK Sender Router Receiver Sender Router Receiver Slow start TCP Timeout cwnd ACK clocking, with 2 packets per ACK cwnd x timeout Sender Router Receiver retransmit NB: There’s a proposed alternative to slow-start that uses ACK clocking cumulative ack 2
Timeout Handling Congestion Threshold Cumulative ACK opens up entire New variable: Congestion Threshold window Target window size Estimate network capacity Do we send entire window all at once? If cwnd < cthresh, increase exponentially No ACKs to clock transmission slow start Use slow-start to recover ACK clock If cwnd > cthresh, increase linearly Reset cwnd to 1 (packet) additive increase Use exponential increase Initially, ctrhesh = max window (add 1 packet to cwnd for every ACK) At loss, ctrhesh = 1/2 cwnd Slow Start Slow Start Initial values Example trace of CongestionWindow cthresh = 8 cwnd = 1 70 Loss after transmission 7 60 50 cwnd currently 12 CW flattens out due to loss KB 40 Linear increase Set cthresh = cwnd/2 30 20 Set cwnd = 1 10 Slow start until CW = CT 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 Timeout: CT = CW/2 = 11, CW = 1 Problem Have to wait for timeout Can lose half CongestionWindow of data Fast Retransmit and Fast Fast Retransmit and Fast Recovery Recovery Problem Send ACK for each segment received Sender Receiver Packet 1 When duplicate ACK’s received Coarse-grain TCP Packet 2 ACK 1 timeouts lead to Resend lost segment immediately Packet 3 Packet 4 ACK 2 idle periods Do not wait for timeout Packet 5 ACK 2 In practice, retransmit on 3rd duplicate Solution Packet 6 ACK 2 Fast recovery Fast retransmit: ACK 2 When fast retransmission occurs, skip slow start use duplicate Retransmit packet 3 Congestion window becomes 1/2 previous ACKs to trigger ACK 6 Start additive increase immediately retransmission 3
TCP Congestion Window TCP Congestion Control Trace Summary Congestion control mechanisms 70 threshold 60 congestion Timeouts timeouts window Congestion Window 50 RTT estimation fast retransmission 40 Congestion window 30 Slow start 20 additive increase Fast retransmit 10 slow start period 0 0 10 20 30 40 50 60 Time Fairness What’s Fair? TCP congestion control is fair Both senders will settle at around 5 Mbps Flow A Intuition: flows using more bandwidth Flow B Flow C Flow D more likely to experience loss Which is more fair: This is the so- called “max-min Globally Fair: Fa = Capacity/4, Fb = Fc = Fd fair” rate = 3Capacity/4 Sender 1 Receiver 1 allocation. The 20 Mbps 10 Mbps or minimum rate is Router maximized. Locally Fair: Fa = Fb = Fc = Fd = Capacity/2 Sender 2 Receiver 2 TCP fairness Why is TCP fair? Two competing sessions: TCP is “RTT-fair” Additive increase improves fairness Multiplicative decrease preserves fairness On each congested link, host gets shared of bandwidth proportional to RTT R equal bandwidth share Intuition: during additive increase, each t u host adds one new packet every RTT p h g u If RTT twice as large, additive increase is half o loss: decrease window by factor of 2 r h congestion avoidance: additive increase as fast t 2 loss: decrease window by factor of 2 n Is this closer to globally fair or locally fair? congestion avoidance: additive increase o i t c e n n o C Connection 1 throughput R 4
Congestion Avoidance Congestion Avoidance TCP’s strategy Control vs. avoidance Repeatedly cause congestion Control: minimize impact of congestion when it occurs Control it once it happens Avoidance: avoid producing congestion Alternative Strategy In terms of operating point limits Predict when congestion is about to happen and reduce the rate at which hosts send data just before packets start being discarded optimal load Congestion avoidance, as compared to congestion control Approaches avoidance control Routers implement CA (ATM, RSVP) idealized power Routers help end-hosts implement CA (DECbit, RED) power curve End-hosts do it themselves (TCP Vegas) load DECbit (Destination Experiencing Congestion Bit) DECbit Developed for the Digital Network Router Architecture Monitors length over last busy + idle cycle Sets congestion bit if average queue length is greater then 1 Basic idea when packet arrives One bit allocated in packet header Attempts to balance throughput against delay Any router experiencing congestion sets bit smaller values result in more idle time Source adjusts rate based on bits larger values result in more queueing delay Note that responsibility is shared Queue length Averaging interval Routers identify congestion Current time Hosts act to avoid congestion Time Previous cycle Current cycle Router-Based Congestion DECbit Avoidance End Hosts Random Early Detection (RED) gateways Destination echoes congestion bit back to source Developed for use with TCP Source records how many packets resulted in set bit Basic idea If less than 50% of last window had bit set Implicit rather than explicit notification Increase CongestionWindow by 1 packet When a router is “almost” congested If 50% or more of last window had bit set Drop packets randomly Decrease CongestionWindow by 1/8th Responsibility is again shared Note: Router identifies, host acts Techniques used in DECbit known as explicit congestion Relies on TCP’s response to dropped packets notification (ECN) Proposal to add ECN bit to TCP in progress 5
Recommend
More recommend