Presentation is loading. Please wait.

Presentation is loading. Please wait.

Univ. of TehranIntroduction to Computer Network1 An Introduction Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE.

Similar presentations


Presentation on theme: "Univ. of TehranIntroduction to Computer Network1 An Introduction Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE."— Presentation transcript:

1 Univ. of TehranIntroduction to Computer Network1 An Introduction Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Congestion Control Lecture 11: Congestion Control

2 Univ. of TehranIntroduction to Computer Network2 Outline Allocating resource among competing users. Bandwidth on the line Buffers on the routers Congestion control and resource allocation, two side of the same coin. Different congestion control Policies. Reacting to Congestion Avoiding Congestion

3 Univ. of TehranIntroduction to Computer Network3 Congestion Different sources compete for resources inside network Why is it a problem? Sources are unaware of current state of resource Sources are unaware of each other In many situations will result in < 1.5 Mbps of throughput (congestion collapse) 10 Mbps 100 Mbps 1.5 Mbps

4 Univ. of TehranIntroduction to Computer Network4 Issues Two sides of the same coin pre-allocate resources so to avoid congestion control congestion if (and when) is occurs Two points of implementation hosts at the edges of the network (transport protocol) routers inside the network (queuing discipline) Underlying service model best-effort (assume for now) multiple qualities of service (later) Destination 1.5-Mbps T1 link Router Source 2 1 100-Mbps FDDI 10-Mbps Ethernet

5 Univ. of TehranIntroduction to Computer Network5 Why is Congestion Bad? Wasted bandwidth: retransmission of dropped packets. Poor user service : unpredictable delay, reduced throughput. Increased load can even result in lower network throughput. » Switched nets: heavy traffic -> long queues -> lost packets ->retransmits » Ethernet: high demand -> many collisions » compare with highways: too much traffic slows down throughput Solutions? Redesign the network. » Add capacity to congested links » Reroute traffic. » What are the options?

6 Univ. of TehranIntroduction to Computer Network6 Evaluation We need to know how good is a resource allocation/congestion aviodness mechanism. Fairness Power of network (ratio of throughput to delay), Maximize this ratio. Distributedness Efficiency Optimal load Load Throughput/delay

7 Univ. of TehranIntroduction to Computer Network7 Evaluation ( Fairness ) What is fair resource allocation? Equal share of bandwidth How about the length of paths? Given a set of flow throughput (x 1,x 2,…, x n ) f(x 1,x 2,…, x n )= (Σ i=1 n x i ) 2 /n Σ i=1 n x i 2 Fairness is always between 0, 1 and 1 completely fair and 0 completely unfair.

8 Univ. of TehranIntroduction to Computer Network8 Possible Solutions Redesign the network. » Add capacity to congested links » Very slow solution: takes days to months! Reroute traffic. » Alternate paths are not always available » Also too slow: takes 10s of seconds » In practice, most routing algorithms are static Adjust the load in the network. Load balancing » What are the options?

9 Univ. of TehranIntroduction to Computer Network9 Principles of Congestion Control Congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queuing in router buffers) a top-10 problem!

10 Univ. of TehranIntroduction to Computer Network10 Causes/costs of congestion: scenario 1 two senders, two receivers one router, infinite buffers no retransmission large delays when congested maximum achievable throughput

11 Univ. of TehranIntroduction to Computer Network11 Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit in Q: what happens as and increase ? in

12 Univ. of TehranIntroduction to Computer Network12 Causes/costs of congestion: scenario 3 Another “cost” of congestion: when packet dropped, any “upstream transmission capacity used for that packet was wasted!

13 Univ. of TehranIntroduction to Computer Network13 Framework Connectionless flows sequence of packets sent between source/destination pair maintain soft state at the routers Router Source 2 1 3 Router Destination 2 1

14 Univ. of TehranIntroduction to Computer Network14 Framework (cont) Taxonomy: different approaches for congestion Ctrl. router-centric versus host-centric: Router-Centric: each router takes the responsibility for dropping packets, and informing the generating host the amount of traffic allowed to be sent. Host-Centric: the end hosts observe the amount of traffic that is successfully getting through the network and adjust their transmission rates accordingly. reservation-based versus feedback-based Reservation-Based: the end host asks the network for a certain amount of bandwidth when requesting a connection (or flow). If the network does not have enough bandwidth it will reject the connection. Feedback-Based: the end hosts send data without first reserving any capacity and then adjust their sending rate according to the feedback they received Explicit feedback Implicit feedback.

15 Univ. of TehranIntroduction to Computer Network15 Framework (cont) window-based versus rate-based: Window-Based: the receiver advertises a window to the sender. The window corresponds to how much buffer space the receiver has and it limits how much data the sender can transmit. Network also can do that, like X.25. Rate-Based: How many bit the sender can send or the network can absorb. Rate-Based can support video. Rate-Based still is an open problem

16 Univ. of TehranIntroduction to Computer Network16 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

17 Univ. of TehranIntroduction to Computer Network17 What’s Really Happening? Knee – point after which throughput increases very slow delay increases fast Cliff – point after which throughput starts to decrease very fast to zero (congestion collapse) delay approaches infinity Load Throughput Delay kneecliff congestion collapse packet loss

18 Univ. of TehranIntroduction to Computer Network18 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 (self-clocking) This maintains the number of packets in network “constant”

19 Univ. of TehranIntroduction to Computer Network19 Self-clocking PrPr PbPb ArAr AbAb Receiver Sender AsAs

20 Univ. of TehranIntroduction to Computer Network20 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

21 Univ. of TehranIntroduction to Computer Network21 TCP Congestion Control Idea assumes best-effort network (FIFO or FQ routers)each source determines network capacity for itself uses implicit feedback ACKs pace transmission (self-clocking) Challenge determining the available capacity in the first place adjusting to changes in the available capacity

22 Univ. of TehranIntroduction to Computer Network22 Additive Increase/ Multiplicative Decrease Objective: adjust to changes in the available capacity New state variable per connection : CongestionWindow (cwnd) Idea: increase Cwnd when congestion goes down decrease Cwnd when congestion goes up EffectiveWindow = MaxWindow – (LastByteSent – LastByteAcked) MaxWindow = min(cwnd, AdvertisedWindow) LastByteAcked LastByteSent sequence number increases

23 Univ. of TehranIntroduction to Computer Network23 AIMD (cont) Question: how does the source determine whether or not the network is congested? Answer: a timeout occurs timeout signals that a packet was lost packets are seldom lost due to transmission error lost packet implies congestion

24 Univ. of TehranIntroduction to Computer Network24 AIMD (cont) In practice: increment a little for each ACK Increment = MSS * (MSS/cwnd) cwnd += Increment MSS= Maximum segment size Source Destination … Algorithm increment Cwnd by one packet per RTT (linear or additive increase) divide Cwnd by two whenever a timeout occurs (multiplicative decrease)

25 Univ. of TehranIntroduction to Computer Network25 AIMD (cont) Trace: saw tooth behavior 60 20 1.02.03.04.05.06.07.08.09.0 KB Time (seconds) 70 30 40 50 10 10.0

26 26 TCP: Slow Start Question? How much is the initial cwnd size? Small cwnd implies less network utilization Big cwnd means congestion again What is optimal of cwnd. Solution: Start with cwnd =1 and Quickly increase cwnd until network congested  get a rough estimate of the optimal of cwnd Each time a segment is acknowledged increment cwnd by one (cwnd++) Increase of cwnd is exponential

27 Univ. of TehranIntroduction to Computer Network27 Slow Start Example TCP slows down the increase of cwnd when cwnd >=ssthresh Ssthresh - slow start threshold value. After ssthresh, TCP change from slow start to congestion avoidance! ACK for segment 1 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK for segments 2 + 3 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK for segments 4+5+6+7 cwnd = 8 source destination

28 Univ. of TehranIntroduction to Computer Network28 Slow Start/Congestion Avoidance Example Assume that ssthresh = 8 Roundtrip times Cwnd (in segments) ssthresh cwnd = 1 cwnd = 2 cwnd = 4 cwnd = 8 cwnd = 9 cwnd = 10 Client Server 0 2 4 6 8 10 12 14 t = 0 t = 2 t = 4 t = 6

29 29 Putting Everything Together: TCP Pseudocode Initially: cwnd = 1; ssthresh = infinite; New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd; Timeout: /* Multiplicative decrease */ ssthresh = win/2; cwnd = 1; /* Again slow start */

30 30 The big picture Time cwnd Timeout Slow Start Congestion Avoidance

31 Univ. of TehranIntroduction to Computer Network31 Slow Start (cont) Exponential growth, but slower than all at once Used… when first starting connection when connection goes dead waiting for timeout Trace Problem: lose up to half a Cwnd ’s worth of data

32 Univ. of TehranIntroduction to Computer Network32 Packet Loss Detection Wait for Retransmission Time Out (RTO) What’s the problem with this? Because RTO is performance killer In BSD TCP implementation, RTO is usually more than 1 second the granularity of RTT estimate is 500 ms retransmission timeout is at least two times of RTT Solution: Don’t wait for RTO to expire

33 Univ. of TehranIntroduction to Computer Network33 Fast Retransmit Resend a segment after 3 duplicate ACKs Remember, a duplicate ACK means that an out-of sequence segment was received Notes: Duplicate ACKs due packet reordering! If window is small won’t get duplicate ACKs! ACK 2 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK 4 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK 3 3 duplicate ACKs ACK 4 Set cwnd to 1 after each retransmit!! source destination

34 Univ. of TehranIntroduction to Computer Network34 Results Compare to slow start, it avoids long time out waiting in 4.0 – 5.0 period. How avoid slow start at each fast retransmission?

35 Univ. of TehranIntroduction to Computer Network35 Fast Recovery After a fast-retransmit set cwnd to ssthresh/2 i.e., don’t reset cwnd to 1, then, avoid slow start again!. But when RTO expires still do cwnd = 1 Fast Retransmit and Fast Recovery  implemented by TCP Reno; most widely used version of TCP today

36 36 Fast Retransmit and Fast Recovery Prevent expensive timeouts No need to slow start again At steady state, cwnd oscillates around the optimal window size. Time cwnd Slow Start Congestion Avoidance Fast retransmit

37 Univ. of TehranIntroduction to Computer Network37 Congestion Control Summary Architecture: end system detects congestion and slow down Starting point: Slow start/congestion avoidance packet drop detected by retransmission timeout RTO as congestion signal Fast retransmission/fast recovery packet drop detected by (three) duplicate acks Router support Binary feedback scheme: explicit signaling Today Explicit Congestion Notification [RF99]

38 Univ. of TehranIntroduction to Computer Network38 Congestion Control vs. Congestion Avoidance Congestion control goal Stay left of cliff Congestion avoidance goal Stay left of knee Load Throughput kneecliff congestion collapse

39 Univ. of TehranIntroduction to Computer Network39 Congestion Avoidance TCP’s strategy control congestion once it happens repeatedly increase load in an effort to find the point at which congestion occurs, and then back off Alternative strategy predict when congestion is about to happen reduce rate before packets start being discarded call this congestion avoidance, instead of congestion control Two possibilities router-centric: DECbit and RED Gateways host-centric: TCP Vegas

40 Univ. of TehranIntroduction to Computer Network40 DECbit Add binary congestion bit to each packet header Router monitors average queue length over last busy+idle cycle set congestion bit if average queue length > 1 attempts to balance throughout against delay Queue length Current time Time Current cycle Previous cycle Averaging interval

41 Univ. of TehranIntroduction to Computer Network41 End Hosts Destination echoes bit back to source Source records how many packets resulted in set bit If less than 50% of last window’s worth had bit set increase Cwnd by 1 packet If 50% or more of last window’s worth had bit set decrease CongestionWindow by 0.875 times

42 Univ. of TehranIntroduction to Computer Network42 Random Early Detection (RED) Notification is implicit just drop the packet (TCP will timeout) could make explicit by marking the packet Early random drop rather than wait for queue to become full, drop each arriving packet with some drop probability whenever the queue length exceeds some drop level

43 Univ. of TehranIntroduction to Computer Network43 RED Details Compute average queue length AvgLen AvgLen = (1 - Weight) * AvgLen + Weight * SampleLen 0 < Weight < 1 (usually 0.002) SampleLen is queue length each time a packet arrives MaxThresholdMinThreshold AvgLen Queue

44 Univ. of TehranIntroduction to Computer Network44 RED Details (cont) Two queue length thresholds if AvgLen <= MinThreshold then enqueue the packet if MinThreshold < AvgLen < MaxThreshold then calculate probability P drop arriving packet with probability P if ManThreshold <= AvgLen then drop arriving packet

45 Univ. of TehranIntroduction to Computer Network45 RED Details (cont) Computing probability P TempP = MaxP * (AvgLen - MinThreshold)/ (MaxThreshold - MinThreshold) P = TempP/(1 - count * TempP) Drop Probability Curve P(drop ) 1.0 MaxP MinThreshMaxThresh AvgLen Count is the # of queued from last drop.

46 Univ. of TehranIntroduction to Computer Network46 Tuning RED P of a particular flow’s packet(s) is roughly proportional to the share of the flow’s bandwidth. MaxP is typically 0.02, meaning when is halfway between the two thresholds, router drops roughly one out of 50 packets. If traffic is bursty, then MinTh. should be sufficiently large to allow link utilization to be acceptably high. Difference between two thresholds should be larger than the typical increase in the calculated average queue length in one RTT; setting MaxThreshold to twice MinThreshold is reasonable. Penalty Box for Offenders

47 Univ. of TehranIntroduction to Computer Network47 Sourced-based Cong. Avoidance End hosts adapt traffic before any lost in the net. Watch for router queue’s lengths by checking RTT. A collection of related algorithms In each 2 RTT check if RTT > (minRTT + maxRTT)/2 -> decrease cwnd, cwnd -= cwnd/8. Increase otherwise. Check (currentWind –oldWind)x (CurrentRTT- oldRTT), if the result is positive, decrease cwnd, cwnd -= cwnd/8. Increase 1 otherwise. Check flattening of sending rate. Increase Cwnd by 1 in each RTT, compare throughput with previous one, if it is less than half of one packet, decrease cwnd by one. TCP Vegas is like the last one with a difference to compare to expected rate.

48 Univ. of TehranIntroduction to Computer Network48 TCP Vegas Idea: source watches for some sign that router’s queue is building up and congestion will happen too; e.g., RTT grows sending rate flattens Top is cwn size Middle is ave. rate in source Bottom is ave. queue length in the bottleneck router In Shade, Cwnd increase, but ave. rate stay flat.

49 Univ. of TehranIntroduction to Computer Network49 TCP Vegas Keep track of extra data in the network. Extra data is the amount more than available bandwidth. Maintain “Right” amount of extra data.

50 Univ. of TehranIntroduction to Computer Network50 Algorithm Let BaseRTT be the minimum of all measured RTTs (commonly the RTT of the first packet) If not overflowing the connection, then ExpectRate = Cwnd/BaseRTT Source calculates sending rate ( ActualRate ) once per RTT Source compares ActualRate with ExpectRate Diff = ExpectedRate - ActualRate if Diff <  increase Cwnd linearly else if Diff >  decrease Cwnd linearly else leave Cwnd unchanged

51 Univ. of TehranIntroduction to Computer Network51 Algorithm (cont) Parameters   = 1 packet   = 3 packets Top Cwn size Even faster retransmit keep fine-grained timestamps for each packet check for timeout on first duplicate ACK black line is Actual rate Colored expected rate Shade area is  and 


Download ppt "Univ. of TehranIntroduction to Computer Network1 An Introduction Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE."

Similar presentations


Ads by Google