940 likes | 1.21k Views
Computer Networks (Graduate level). Lecture 8: Congestion Control. University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani. Congestion Control. Congestion control basics TCP congestion control Assigned reading [JK88] Congestion Avoidance and Control
E N D
Computer Networks(Graduate level) Lecture 8: Congestion Control University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Computer Network
Congestion Control • Congestion control basics • TCP congestion control • Assigned reading • [JK88] Congestion Avoidance and Control • [CJ89] Analysis of the Increase and Decrease Algorithms for Congestion Avoidance in Computer Networks Computer Network
Overview • Congestion sources and collapse • Congestion control basics • TCP congestion control • TCP interactions Computer Network
Why End-to-End Protocols? • Underlying best-effort network • Drop/ reorder messages • delivers duplicate copies of a given message • limits messages to some finite size • delivers messages after an arbitrarily long delay • multiple application processes on each host • Different speed of sender and receiver (Flow control) • Congestion in the network (Congestion controls) • Initially, there was no end to end protocol. Now: • UDP: A simple end to end protocol • TCP: Reliable Transport protocol Computer Network
Reliable Transport (TCP) • Communication abstraction: • Connection oriented, Point to point • Reliable • Error Detection and correction • Ordered • Byte-stream • Application writes bytes • TCP sends segments • Application reads bytes • Full duplex, two way connection • Flow and congestion controlled • Protocol implemented entirely at the ends • Fate sharing Computer Network
Difference From Link Layers • Logical link vs. physical link • Must establish connection • Variable RTT • May vary within a connection • Reordering packets • How long can packets live max segment lifetime • Can’t expect endpoints to exactly match link • Buffer space availability • Packets in transmission, delay X bandwidth • Transmission rate • Don’t directly know media/network transmission rate (Congestion) • Try to adapt to the situation. Computer Network
10 Mbps 1.5 Mbps 100 Mbps Congestion • Different sources compete for resources inside network where thery are unaware of current state of resource and each other • In general it is resource allocation problem. • manifestations: • lost packets (buffer overflow at routers) • long delays (queuing in router buffers) Computer Network
two senders, two receivers one router, infinite buffers no retransmission large delays when congested maximum achievable throughput Causes/costs of congestion: scenario 1 Computer Network
one router, finite buffers sender retransmission of lost packet Causes/costs of congestion: scenario 2 Computer Network
always: (goodput) “perfect” retransmission only when loss: retransmission of delayed (not lost) packet makes larger (than perfect case) for same l l l > = l l in in in out out Causes/costs of congestion: scenario 2 “costs” of congestion: • more work (retrans) for given “goodput” • unneeded retransmissions: link carries multiple copies of pkt Computer Network
four senders multihop paths timeout/retransmit l l in in Causes/costs of congestion: scenario 3 Q:what happens as and increase ? Computer Network
Causes/costs of congestion: scenario 3 Another “cost” of congestion: • when packet dropped, any “upstream transmission capacity used for that packet was wasted! Computer Network
End-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate sender should send at Approaches towards congestion control Two broad approaches towards congestion control: Computer Network
Congestion Collapse • Increase in network load results in decrease of useful work done and crash the network ability to deliver data • Possible causes • Spurious retransmissions of packets still in flight • Classical congestion collapse • How can this happen with packet conservation? • Solution: better timers and TCP congestion control • Undelivered packets • Packets consume resources and are dropped elsewhere in network • Solution: congestion control for ALL traffic Computer Network
Other Congestion Collapse Causes • Fragments • Mismatch of transmission and retransmission units • Solutions • Make network drop all fragments of a packet (early packet discard in ATM) • Do path MTU discovery • Control traffic • Large percentage of traffic is for control • Headers, routing messages, DNS, etc. • Stale or unwanted packets • Packets that are delayed on long queues • “Push” data that is never used Computer Network
Where to Prevent Collapse? • Can end hosts prevent problem? • Yes, but must trust end hosts to do right thing • E.g., sending host must adjust amount of data it puts in the network based on detected congestion • Can routers prevent collapse? • No, not all forms of collapse • Doesn’t mean they can’t help • Sending accurate congestion signals • Isolating well-behaved from ill-behaved sources Computer Network
Congestion Control and Avoidance • A mechanism which: • Uses network resources efficiently • Preserves fair network resource allocation • Prevents or avoids collapse • Congestion collapse is not just a theory • Has been frequently observed in many networks • It is a top 10 problem. Computer Network
Congestion Collapse and Efficiency • knee – point after which • throughput increasesslowly • delay increases quickly • cliff – point after which • throughput decreases quicklyto zero (congestion collapse) • delay goes to infinity • Congestion avoidance • stay at knee • Congestion control • stay left of (but usually close to) cliff • Note (in an M/M/1 queue) • delay =1/(1 – utilization) knee cliff congestion collapse Throughput under utilization over utilization saturation Load Delay Load Computer Network
Goals • Operate near the knee point • Remain in equilibrium • How to maintain equilibrium? • Don’t put a packet into network until another packet leaves. How do you do it? • Use ACK: send a new packet only after you receive and ACK. Why? • Maintain number of packets in network “constant” Computer Network
How Do You Do It? • Detect when network approaches/reaches knee point • Stay there • Questions • How do you get there? • What if you overshoot (i.e., go over knee point) ? • Possible solution: • Increase window size until you notice congestion • Decrease window size if network congested Computer Network
Overview • Congestion sources and collapse • Congestion control basics • TCP congestion control • TCP interactions Computer Network
xi>Xgoal Control System Model [CJ89] • Simple, yet powerful model • Explicit binary signal of congestion • Why explicit (TCP uses implicit)? • Implicit allocation of bandwidth x1 User 1 x2 User 2 xn User n y Computer Network
Objectives • Simple router behavior • Distributedness • Efficiency: Xknee = Sxi(t) • Fairness: (Sxi)2/n(Sxi2) • Power: (throughputa/delay) • Convergence: control system must be stable, responsiveness. Computer Network
Throughput/delay Optimal Load load Power • Power (ratio of throughput to delay) Computer Network
Fair Allocation • Maxmin fairness • Flows which share the same bottleneck get the same amount of bandwidth • Assumes no knowledge of priorities • Fairness = 1 - distance from fairness line 2 user example 2 getting too much fairness line User 2: x2 1 getting too much User 1: x1 Computer Network
Basic Control Model • Let’s assume window-based control • Reduce window when congestion is perceived • How is congestion signaled? • Either mark or drop packets • When is a router congested? • Drop tail queues – when queue is full • Average queue length – at some threshold • Increase window otherwise • Probe for available bandwidth – how? Computer Network
Linear Control • Many different possibilities for reaction to congestion and probing • Examine simple linear controls • Window(t + 1) = a + b Window(t) • Different ai/bi for increase and ad/bd for decrease • Supports various reaction to signals • Increase/decrease additively • Increased/decrease multiplicatively • Which of the four combinations is optimal? Computer Network
Possible Choices • Multiplicative increase, additive decrease • aI=0, bI>1, aD<0, bD=1 • Additive increase, additive decrease • aI>0, bI=1, aD<0, bD=1 • Multiplicative increase, multiplicative decrease • aI=0, bI>1, aD=0, 0<bD<1 • Additive increase, multiplicative decrease • aI>0, bI=1, aD=0, 0<bD<1 • Which one? Computer Network
Phase plots • What are desirable properties? • What if flows are not equal? Fairness Line Overload User 2’s Allocation x2 Optimal point Underutilization Efficiency Line User 1’s Allocation x1 Computer Network
Phase plots • Simple way to visualize behavior of competing connections over time Fairness Line User 2’s Allocation x2 Efficiency Line User 1’s Allocation x1 Computer Network
Additive Increase/Decrease • Both X1 and X2 increase/decrease by the same amount over time • Additive increase improves efficiency and additive decrease reduces efficiency Fairness Line T1 User 2’s Allocation x2 T0 Efficiency Line User 1’s Allocation x1 Computer Network
Muliplicative Increase/Decrease • Both X1 and X2 increase by the same factor over time • Extension from origin – constant fairness Fairness Line T1 User 2’s Allocation x2 T0 Efficiency Line User 1’s Allocation x1 Computer Network
Convergence to Efficiency Fairness Line xH User 2’s Allocation x2 Efficiency Line User 1’s Allocation x1 Computer Network
Convergence to Fairness Fairness Line xH User 2’s Allocation x2 xH’ Efficiency Line User 1’s Allocation x1 Computer Network
Convergence to Efficiency & Fairness Fairness Line xH User 2’s Allocation x2 xH’ Efficiency Line User 1’s Allocation x1 Computer Network
Increase Fairness Line User 2’s Allocation x2 xL Efficiency Line User 1’s Allocation x1 Computer Network
Constraints • Distributed efficiency • I.e., Window(t+1) > Window(t) during increase • ai > 0 & bi> 1 • Similarly, ad < 0 & bd< 1 • Must never decrease fairness • a & b’s must be > 0 • ai/bi > 0 and ad/bd 0 • Full constraints • ad = 0, 0 bd < 1, ai > 0 and bi = 1 Computer Network
Fairness Line x1 x0 User 2’s Allocation x2 x2 Efficiency Line User 1’s Allocation x1 What is the Right Choice? • Constraints limit us to AIMD • Can have multiplicative term in increase • AIMD moves towards optimal point Computer Network
Overview • Congestion sources and collapse • Congestion control basics • TCP congestion control • TCP interactions Computer Network
TCP Congestion Control • Motivated by ARPANET congestion collapse • Underlying design principle: packet conservation • At equilibrium, inject packet into network only when one is removed • Basis for stability of physical systems • Why was this not working? • Connection doesn’t reach equilibrium • Spurious retransmissions • Resource limitations prevent equilibrium Computer Network
TCP Congestion Control - Solutions • Reaching equilibrium • Slow start • Eliminates spurious retransmissions • Accurate RTO estimation • Fast retransmit • Adapting to resource availability • Congestion avoidance Computer Network
TCP Congestion Control Basics • Keep a congestion window, cwnd • Denotes how much network is able to absorb • Sender’s maximum window: • Min (advertised window, cwnd) • Sender’s actual window: • Max window - unacknowledged segments • If we have large actual window, should we send data in one shot? • No, use acks to clock sending new data Computer Network
Self-clocking Pr Pb Sender Receiver Ab As Ar Computer Network
Slow Start • How do we get this clocking behavior to start? • Initialize cwnd = 1 • Upon receipt of every ack, cwnd = cwnd + 1 • Implications • Window actually increases to W in RTT * log2(W) • Can overshoot window and cause packet loss Computer Network
One RTT 0R 1 One pkt time 1R 1 2 3 2R 2 3 4 6 5 7 4 5 6 7 3R 8 10 12 14 9 11 13 15 Slow Start Example Computer Network
Slow Start Sequence Plot . . . Sequence No Time Computer Network
Congestion Avoidance • Loss implies congestion – why? • Not necessarily true on all link types • If loss occurs when cwnd = W • Network can handle 0.5W ~ W segments • Set cwnd to 0.5W (multiplicative decrease) • Upon receiving ACK • Increase cwnd by 1/cwnd • Results in additive increase Computer Network
Return to Slow Start • If packet is lost we lose our self clocking as well • Need to implement slow-start and congestion avoidance together • When timeout occurs set ssthresh to 0.5w • If cwnd < ssthresh, use slow start • Else use congestion avoidance Computer Network
Overall TCP Behavior Window Time Computer Network
Congestion Window Slow start with each time out • Time out is just wasting resource and time • How to prevent it: Do not wait! Fast retransmission Time out Time out Congestion Window Slow Start Time Computer Network