Presentation is loading. Please wait.

Presentation is loading. Please wait.

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 15: Congestion Control I Slides used with.

Similar presentations


Presentation on theme: "T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 15: Congestion Control I Slides used with."— Presentation transcript:

1 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 15: Congestion Control I Slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang

2 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University2 Abstract View We ignore internal structure of network and model it as having a single bottleneck link Sending Host Buffer in bottleneck Router Receiving Host AB

3 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University3 Three Congestion Control Problems Adjusting to bottleneck bandwidth Adjusting to variations in bandwidth Sharing bandwidth between flows

4 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University4 Single Flow, Fixed Bandwidth Adjust rate to match bottleneck bandwidth –without any a priori knowledge –could be gigabit link, could be a modem AB 100 Mbps

5 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University5 Single Flow, Varying Bandwidth Adjust rate to match instantaneous bandwidth Bottleneck can change because of a routing change AB BW(t)

6 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University6 Multiple Flows Two Issues: Adjust total sending rate to match bottleneck bandwidth Allocation of bandwidth between flows A2B2 100 Mbps A1 A3 B3 B1

7 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University7 General Approaches Send without care –many packet drops –could cause congestion collapse Reservations –pre-arrange bandwidth allocations –requires negotiation before sending packets Pricing –don’t drop packets for the high-bidders –requires payment model

8 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University8 General Approaches (cont’d) Dynamic Adjustment (TCP) –Every sender probe network to test level of congestion –speed up when no congestion –slow down when congestion –suboptimal, messy dynamics, simple to implement –Distributed coordination problem!

9 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University9 TCP Congestion Control TCP connection has window –controls number of unacknowledged packets Sending rate: ~Window/RTT Vary window size to control sending rate Introduce a new parameter called congestion window (cwnd) at the sender –Congestion control is mainly a sender-side operation

10 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University10 Congestion Window (cwnd) Limits how much data can be in transit Implemented as # of bytes Described as # packets in this lecture EffectiveWindow = MaxWindow – (LastByteSent – LastByteAcked) MaxWindow = min(cwnd, AdvertisedWindow) LastByteAcked LastByteSent sequence number increases MaxWindow EffectiveWindow

11 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University11 Two Basic Components Detecting congestion Rate adjustment algorithm (change cwnd size) –depends on congestion or not

12 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University12 Detecting Congestion Packet dropping is best sign of congestion –delay-based methods are hard and risky How do you detect packet drops? ACKs –TCP uses ACKs to signal receipt of data –ACK denotes last contiguous byte received actually, ACKs indicate next segment expected Two signs of packet drops –No ACK after certain time interval: time-out –Several duplicate ACKs (ignore for now) May not work well for wireless networks, why?

13 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University13 Sliding (Congestion) Window Sliding window: each ACK = permission to send a new packet –Ex. cwnd = 3

14 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University14 Self-clocking If we have a large window, ACKs “self-clock” the data to the rate of the bottleneck link Observe: received ACK spacing  bottleneck bandwidth PrPr PbPb ArAr AbAb AsAs sender receiver Tiny ACK (very thin)

15 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University15 Rate Adjustment Basic structure: –Upon receipt of ACK (of new data): increase rate Data successfully delivered, perhaps can send faster –Upon detection of loss: decrease rate But what increase/decrease functions should we use? –Depends on what problem we are solving

16 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University16 Fairness? Two competing sessions: Additive increase (AI) gives slope of 1, as throughout increases multiplicative decrease (MD) decreases throughput proportionally R R equal bandwidth share Connection 1 throughput Connection 2 throughput congestion avoidance: additive increase loss: decrease window by factor of 2 Fair and link fully utilized (rate R)

17 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University17 AIMD AB x C DE y Limit rates: x = y

18 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University18 AIMD Sharing Dynamics AB x DE No congestion  rate increases by one packet/RTT every RTT Congestion  decrease rate by factor 2 Rates equalize  fair share y

19 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University19 AIAD AB x C DE y Limit rates: x and y depend on initial values

20 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University20 AIAD Sharing Dynamics AB x DE No congestion  x increases by one packet/RTT every RTT Congestion  decrease x by 1 y

21 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University21 TCP Model Derive an expression for the steady state throughput as a function of –RTT –Loss probability Assumptions –Each packet dropped with iid probability p Methodology: analyze “average” cycle in steady state –How many packets are transmitted per cycle? –What is the duration of a cycle?

22 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University22 Cycles in Steady State Denote W as the (mean) maximum achieved window What is the slope of the line? What are the key values on the time axis?

23 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University23 Cycle Analysis W increase by 1 per RTT

24 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University24 Throughput What is W as a function of p? How long does a cycle last until a drop?

25 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University25 Cycle Length Let index packet loss that ends cycle.

26 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University26 TCP Model Note role of RTT. Is it “fair”? A “macroscopic” model Achieving this throughput is referred to as “TCP Friendly”

27 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University27 Adapting cwin So far: sliding window + self-clocking of ACKs How to know the best cwnd (and best transmission rate)? Phases of TCP congestion control 1.Slow start (getting to equilibrium) 1.Want to find this very very fast and not waste time 2.Congestion Avoidance –Additive increase - gradually probing for additional bandwidth –Multiplicative decrease - decreasing cwnd upon loss/timeout

28 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University28 Phases of Congestion Control Congestion Window (cwnd) Initial value is 1 MSS (=maximum segment size) counted as bytes Actual sender window size used by TCP = minimum (cwnd, receiver advertised win) Slow-start threshold Value (ss_thresh) Initial value is the advertised window size slow start (cwnd < ssthresh) congestion avoidance (cwnd >= ssthresh)

29 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University29 TCP: Slow Start Goal: discover roughly the proper sending rate quickly Whenever starting traffic on a new connection, or whenever increasing traffic after congestion was experienced: Intialize cwnd =1 Each time a segment is acknowledged, increment cwnd by one (cwnd++). Continue until –Reach ss_thresh –Packet loss

30 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University30 Slow Start Illustration The congestion window size grows very rapidly TCP slows down the increase of cwnd when cwnd >= ss_thresh Observe: –Each ACK generates two packets –slow start increases rate exponentially fast (doubled every RTT)! 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

31 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University31 Congestion Avoidance (After Slow Start) Slow Start figures out roughly the rate at which the network starts getting congested Congestion Avoidance continues to react to network condition –Probes for more bandwidth, increase cwnd if more bandwidth available –If congestion detected, aggressive cut back cwnd

32 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University32 Congestion Avoidance: Additive Increase After exiting slow start, slowly increase cwnd to probe for additional available bandwidth –Competing flows may end transmission –May have been “unlucky” with an early drop If cwnd > ss_thresh then each time a segment is acknowledged increment cwnd by 1/cwnd (cwnd += 1/cwnd). cwnd is increased by one only if all segments have been acknowledged –Increases by 1 per RTT, vs. doubling per RTT

33 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University33 Example of Slow Start + Congestion Avoidance Assume that ss_thresh = 8 Roundtrip times Cwnd (in segments) ssthresh

34 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University34 Detecting Congestion via Timeout If there is a packet loss, the ACK for that packet will not be received The packet will eventually timeout –No ack is seen as a sign of congestion

35 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University35 Congestion Avoidance: Multiplicative Decrease Timeout = congestion Each time when congestion occurs, –ss_thresh is set to half the current size of the congestion window: ss_thresh = cwnd / 2 –cwnd is reset to one: cwnd = 1 –and slow-start is entered

36 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University36 TCP illustration Time ss_thresh Timeout Slow Start Congestion Avoidance cwnd ss_thresh

37 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University37 Responses to Congestion (Loss) There are algorithms developed for TCP to respond to congestion –TCP Tahoe - the basic algorithm (discussed previously) –TCP Reno - Tahoe + fast retransmit & fast recovery Most end hosts today implement TCP Reno and many more: –TCP Vegas (research: use timing of ACKs to avoid loss) –TCP SACK (future deployment: selective ACK)

38 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University38 TCP Reno Problem with Tahoe: If a segment is lost, there is a long wait until timeout Reno adds a fast retransmit and fast recovery mechanism Upon receiving 3 duplicate ACKs, retransmit the presumed lost segment (“fast retransmit”) But do not enter slow-start. Instead enter congestion avoidance (“fast recovery”)

39 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University39 Fast Retransmit Resend a segment after 3 duplicate ACKs –remember a duplicate ACK means that an out-of sequence segment was received –ACK-n means packets 1, …, n all received Notes: –duplicate ACKs due to packet reordering! –if window is small don’t get duplicate ACKs! ACK 1 segment 1 cwnd = 1 cwnd = 2 segment 2 segment 3 ACK 3 cwnd = 4 segment 4 segment 5 segment 6 segment 7 ACK 2 3 duplicate ACKs ACK 3

40 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University40 Fast Recovery After a fast-retransmit –cwnd = cwnd/2 (vs. 1 in Tahoe) –ss_thresh = cwnd –i.e. starts congestion avoidance at new cwnd Not slow start from cwnd = 1 After a timeout –ss_thresh = cwnd/2 –cwnd = 1 –Do slow start –Same as Tahoe

41 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University41 Fast Retransmit and Fast Recovery Retransmit after 3 duplicate ACKs –prevent expensive timeouts Slow start only once per session (if no timeouts) In steady state, cwnd oscillates around the ideal window size. Time cwnd Slow Start Congestion Avoidance

42 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University42 TCP Congestion Control Summary Measure available bandwidth –slow start: fast, hard on network –AIMD: slow, gentle on network Detecting congestion –timeout based on RTT robust, causes low throughput –Fast Retransmit: avoids timeouts when few packets lost can be fooled, maintains high throughput Recovering from loss –Fast recovery: don’t set cwnd=1 with fast retransmits

43 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University43 TCP Reno Quick Review Slow-Start if cwnd < ss_thresh –cwnd++ upon every new ACK (exponential growth) –Timeout: ss_thresh = cwnd/2 and cwnd = 1 Congestion avoidance if cwnd >= ss_thresh –Additive Increase Multiplicative Decrease (AIMD) –ACK: cwnd = cwnd + 1/cwnd –Timeout: ss_thresh = cwnd/2 and cwnd = 1 Fast Retransmit & Recovery –3 duplicate ACKS (interpret as packet loss) –Retransmit lost packet –cwnd=cwnd/2, ss_thresh = cwnd

44 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University44 TCP Reno Saw Tooth Behavior Time Congestion Window Initial Slowstart Fast Retransmit and Recovery Slowstart to pace packets Timeouts may still occur

45 T. S. Eugene Ngeugeneng at cs.rice.edu Rice University45 Summary TCP Reno is the de facto standard for congestion control on the Internet AIMD or “TCP friendliness” is expected of distributed applications


Download ppt "T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 15: Congestion Control I Slides used with."

Similar presentations


Ads by Google