37
CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Embed Size (px)

Citation preview

Page 1: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

CS 4700 / CS 5700Network Fundamentals

Lecture 12: Router-Aided Congestion Control(Drop it like it’s hot)

Revised 3/18/13

Page 2: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

2

In Between Network and Transport…

Function: Help TCP control congestion Reduce queue length and

delay Protection from

misbehaving flows Key challenge:

Early detection of congestion

Fairness Tractable implementation

Application

Presentation

SessionTransportNetworkData LinkPhysical

Page 3: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

3

The Danger of Increasing Load

Knee – point after which Throughput increases

very slow Delay increases fast

In an M/M/1 queue Delay = 1/(1 –

utilization) Cliff – point after which

Throughput 0 Delay ∞

Congestion Collapse

Load

Load

Good

pu

tD

ela

y

Knee Cliff

Ideal point

Page 4: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Congestion Control Problems4

cwn

d

Synchronization Periodic lulls of

low utilization

Time

High queuing delay

Page 5: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

End-to-end Congestion Control?5

Application

Transport

Network

Data Link

Physical

Host 1 Router Host 2

Physical

Application

Transport

Network

Data Link

Physical

Network

Data Link

TCP tries to handle congestion control

Routers also impact congestion management Buffer management controls packet drops Packet scheduling influences delay

Router can be layer-3 and still help control congestion!

Page 6: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

6

Random Early Detection Fair Queuing Core-Stateless Fair

Queuing

Outline

Page 7: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

FIFO with Drop Tail

Basic router queue management First in, first out (FIFO) Drop tail: if the queue is full, drop packets at the end

7

Problems: Buffer lock out by misbehaving flows Burst or multiple consecutive packet drops

Bad for TCP fast recovery

Synchronizing effect for multiple TCP flows

Page 8: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

FIFO Router with Two TCP Sessions8

8

Unfairness

Flows synchronize

Low ThroughputHigh Delay

Page 9: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Random Early Detection (RED)

Sometimes called Random Early Drop FIFO scheduling Replaces drop tail buffer management

Probabilistically discard packets Probability is computed as a function of average queue length

Why average queue length? Avoid over responsiveness to transient congestion

9

Page 10: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

RED Variables

min: minimum threshold max: maximum threshold avg_len: (weighted) average queue length

avg_len = (1-w)*avg_len + w*sample_len

Discard Probability (P)

0

1

min max queue_len

10

Average Queue Length

Page 11: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

RED Operation

1. If (avg_len < minth) enqueue packet

2. If (avg_len > maxth) drop packet

3. If (avg_len >= minth and avg_len < maxth) enqueue packet with probability P

11

1 23

Discard Probability (P)

0

1

Average Queue Lengthmin max queue_len

Page 12: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Calculating P

P = max_P*(avg_len – min)/(max – min) Improvements to spread the drops

P’ = P/(1 – count*P), where count = # of packets consecutively enqueued since last

drop

12

Discard Probability (P)

0

1

Average Queue Lengthmin max queue_len

max_P

Pavg_len

Page 13: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

13

RED Example and Advantages

Better absorption of packet bursts Avoids TCP flow synchronization Signals end systems earlier Widely implemented on modern routers

Cisco, Juniper, etc

minmaxqueue_len

Page 14: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

RED Router with Two TCP Flows14

Less unfairness

Less synchronization

More even throughpu

t and delay

Page 15: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

15

Random Early Detection Fair Queuing Core-Stateless Fair

Queuing

Outline

Page 16: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

16

Problems with RED

No protection Misbehaving flows can hurt other flows

0

1

2

3

4

5

6

7

8

9

10

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s) Stateless solution: Random

Early Detection (RED)UDP (#1)

TCP (#32)10 Mbps)

UDP (#1)

TCP (#2)

TCP (#32)...

TCP (#2)...

UDP

31 TCP Flows

Page 17: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

17

Solution?

Provides protection/isolation between flows

Round-robin among different flows (Nagle ‘87) One queue per flow

Page 18: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

18

Problems with Round-Robin

Biased towards flows with large packets

Complexity: requires per flow state in the router Must keep track of number of flows Must maintain flow->queue mapping

You never, EVER want per-flow state in the router.

Page 19: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

19

Solution?

Bit-by-bit round-robin Can you do this in practice?

NO Packets cannot be sliced into bit-size pieces

Packets need to arrive with headers intact Imagine the fragmentation overhead

But, bit-by-bit round-robin can be approximated

Page 20: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

20

Fair Queuing (FQ)

Define a fluid flow system: a system in which flows are served bit-by-bit

Then serve packets in the increasing order of their deadlines

Advantages Each flow will receive exactly its fair rate

FQ achieves max-min fairness

Page 21: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

21

Balancing Fairness vs. Utilization Assume each queue gets to send x bits each

RTT

x

Fair, and high utilization

x

Fair, but capacity is wasted

Page 22: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

22

Max-Min Fairness

If i parties request from resource , each receives i

Allocation is max-min fair IFF1) No user receives more than its request2) No other allocation satisfying 1) has a

higher minimum allocation3) Condition 2) remains true recursively as we

remove the minimal user and reduce its allocation from the total resource

Page 23: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

23

Calculating Max-Min Fairness

Denote C – link capacity N – number of flows ri – desired bandwidth of flow i f – fair share bandwidth

Each flow can receive at most the fair rate, i.e., min(ri, f)

Page 24: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Max-Min Fairness Example

r1 = 8, r2 = 6, r3 = 2

24

min(8, 4) = 4 min(6, 4) = 4 min(2, 4) = 2

108

62

C N C/N Flows w/ ri <= C/N

10 3 3.33

r3 = 2

8 2 4 -------

44

2

C = C - ∑(flows w/ ri <= C/N)

N = N - |flows w/ ri <= C/N|

f = 4

Page 25: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

25

Implementing FQ in Practice

Ideal: do preemptive scheduling between packets on bit-by-bit basis

Practical approximation: serve packets in the order in which they would have finished transmission in the fluid flow system

Page 26: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Practical FQ Example

1 2 3 4 5

1 2 3 4

1 2 31 2

43 4

55 6

1 2 1 3 2 3 4 4

5 6

55 6

Flow 1(Arrival Traffic)

Flow 2(Arrival Traffic)

Servicein Fluid Flow

System

FQ PacketSystem

time

time

time

time

26

Page 27: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

Simulation Example

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s) Stateful solution:

Fair Queuing

0

1

2

3

4

5

6

7

8

9

10

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s) Stateless solution: Random

Early Detection (RED)

UDP (#1)

TCP (#32)10 Mbps)

UDP (#1)

TCP (#2)

TCP (#32)...

TCP (#2)...

UDP

31 TCP Flows

30

Page 28: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

31

Random Early Detection Fair Queuing Core-Stateless Fair

Queuing

Outline

Page 29: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

32

Core-Stateless Fair Queuing

Fair Queuing requires per flow state in routersYou never, EVER want per-flow state in the

router. Core-Stateless Fair Queuing (CSFQ)

eliminates state in some of the routers… … but only approximates FQ

Page 30: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

33

The CSFQ Approach

A contiguous and trusted region of the network Edge routers perform per flow operations Core routers perform no per flow operations

Edge Route

r

Core Route

r

Fair Queuing

Everywhere

Page 31: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

34

Insight of CSFQ

If each packet of a flow with arrival rate r is forwarded with probability: (f = fair rate)

The rate of the flow’s forwarded traffic r’ is

No need to maintain per-flow state if r is carried in the packet

r

fP ,1min

),min(,1min' frr

frPrr

Page 32: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

35

CSFQ Algorithm Outline

1. Ingress routers: estimate r, insert into packet header

2. Core routers: Compute fair rate f on the output link (no

state) Enqueue packet with probability P = min(1, f/r) Update packet label to r = min(r, f)

3. Egress router: remove extra state from packet header

Page 33: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

36

CSFQ Algorithm Example

Maintains per flow state

Insert r into header

Ingress Core Egress

r

Compute f Enqueue with

P = min(1, f/r) Update r in

packet header

r'

Remove extra header

Page 34: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

37

Another CSFQ Example

Assume fair rate f = 4 Flow 1, r1 = 8, P = min(1, 4/8) = 0.5

Expected rate: 8*P = 4 Flow 2, r2 = 6, P = min(1, 4/6) = 0.67

Expected rate: 6*P = 4 Flow 3, r3 = 2, P = min(1, 4/2) = 1

Expected rate: 2*P = 2

108

6

2

8

6

22

666

8 8 8 8 4

4

2

4

4

4

4

2

44

2

Page 35: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

CSFQ Fair Rate Estimation

To calculate the fair rate f, core routers estimate Aggregate arrival rate A Aggregate rate of accepted traffic F

(arrival rate – dropped packets) Fair rate f is computed periodically as:

If there is no congestion (A<=C where C is link capacity), then f is set to the maximum ri(t)

If the link is congested, then fnew = fold* C/F

38

Page 36: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

39Simulation Example

39

10 Mbps)

UDP (#1)

TCP (#2)

TCP (#32)...

UDP (#1)

TCP (#2)

TCP (#32)

...

0

1

2

3

4

5

6

7

8

9

10

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s)

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s)

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

1 4 7 10 13 16 19 22 25 28 31Flow Number

Th

rou

gh

pu

t(M

bp

s)

Stateful solution: Fair Queuing

Core-Stateless Fair Queuing

Stateless solution: RED

UDP

31 TCP Flows

Page 37: CS 4700 / CS 5700 Network Fundamentals Lecture 12: Router-Aided Congestion Control (Drop it like it’s hot) Revised 3/18/13

40

Summary

FQ does not eliminate congestion It just manages congestion

You need end-host congestion control and router support End-host congestion control for adaptability Router congestion control for

protection/isolation Don’t forget about buffer management

FQ still needs to drop in case of congestion Which packets do you drop?