44
Katz, Stoica F04 EECS 122: Introduction to Computer Networks Packet Scheduling and QoS Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA 94720-1776

EECS 122: Introduction to Computer Networks Packet Scheduling and QoS

Embed Size (px)

DESCRIPTION

EECS 122: Introduction to Computer Networks Packet Scheduling and QoS. Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley, CA 94720-1776. Today’s Lecture: 15. 2. 17, 18, 19. Application. 10,11. 6. Transport. - PowerPoint PPT Presentation

Citation preview

Page 1: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

Katz, Stoica F04

EECS 122: Introduction to Computer Networks

Packet Scheduling and QoS

Computer Science Division

Department of Electrical Engineering and Computer Sciences

University of California, Berkeley

Berkeley, CA 94720-1776

Page 2: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

2Katz, Stoica F04

Today’s Lecture: 15

Network (IP)

Application

Transport

Link

Physical

2

7, 8, 9

10,11

17, 18, 19

14, 15, 16

21, 22, 23

25

6

Page 3: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

3Katz, Stoica F04

Packet Scheduling

Decide when and what packet to send on output link- Usually implemented at output interface of a router

1

2

Scheduler

flow 1

flow 2

flow n

Classifier

Buffer management

Page 4: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

4Katz, Stoica F04

Goals of Packet Scheduling

Provide per flow/aggregate QoS guarantees in terms of delay and bandwidth

Provide per flow/aggregate protection Flow/Aggregate identified by a subset of following fields in

the packet header - source/destination IP address (32 bits)

- source/destination port number (16 bits)

- protocol type (8 bits)

- type of service (8 bits) Examples:

- All packets from machine A to machine B

- All packets from Berkeley

- All packets between Berkeley and MIT

- All TCP packets from EECS-Berkeley

Page 5: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

5Katz, Stoica F04

Outline

QoS guarantees Link sharing Service curve (short)

Page 6: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

6Katz, Stoica F04

Recap: Token Bucket and Arrival Curve

Parameters- r – average rate, i.e., rate at which tokens fill the bucket- b – bucket depth- R – maximum link capacity or peak rate (optional parameter)

A bit is transmitted only when there is an available token Arrival curve – maximum number of bits transmitted within an

interval of time of size t

r bps

b bits

<= R bps

regulatortime

bits

b*R/(R-r)

slope R

slope r

Arrival curve

Page 7: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

7Katz, Stoica F04

How Is the Token Bucket Used?

Can be enforced by - End-hosts (e.g., cable modems)

- Routers (e.g., ingress routers in a Diffserv domain)

Can be used to characterize the traffic sent by an end-host

Page 8: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

8Katz, Stoica F04

Source Traffic Characterization

Arrival curve – maximum amount of bits transmitted during an interval of time Δt

Use token bucket to bound the arrival curve

Δt

bits

Arrival curve

time

bps

Page 9: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

9Katz, Stoica F04

Source Traffic Characterization: Example

Arrival curve – maximum amount of bits transmitted during an interval of time Δt

Use token bucket to bound the arrival curve

bitsArrival curve

time

bps

0 1 2 3 4 5

1

2

1 2 3 4 5

1

2

3

4

(R=2,b=1,r=1)

Δt

Page 10: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

10Katz, Stoica F04

QoS Guarantees: Per-hop Reservation

End-host: specify- the arrival rate characterized by token-bucket with parameters (b,r,R)- the maximum maximum admissible delay D

Router: allocate bandwidth ra and buffer space Ba such that - no packet is dropped- no packet experiences a delay larger than D

bits

b*R/(R-r)

slope rArrival curve

DBa

slope ra

Page 11: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

11Katz, Stoica F04

Packet Scheduling

Make sure that at any time the flow receives at least the allocated rate ra

The canonical example of such scheduler: Weighted Fair Queueing (WFQ)

Page 12: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

12Katz, Stoica F04

Recap: Fair Queueing

Implements max-min fairness: each flow receives min(ri, f) , where

- ri – flow arrival rate

- f – link fair rate (see next slide)

Weighted Fair Queueing (WFQ) – associate a weight with each flow

Page 13: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

13Katz, Stoica F04

Fair Rate Computation: Example 1

If link congested, compute f such that

Cfri

i ),min(

8

6

244

2

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

10

Page 14: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

14Katz, Stoica F04

Fair Rate Computation: Example 2

Associate a weight wi with each flow i If link congested, compute f such that

Cwfr ii

i ),min(

8

6

244

2

f = 2: min(8, 2*3) = 6 min(6, 2*1) = 2 min(2, 2*1) = 2

10(w1 = 3)

(w2 = 1)

(w3 = 1)

If Σk wk <= C, flow i is guaranteed to be allocated a rate >= wi

Flow i is guaranteed to be allocated a rate >= wi*C/(Σk wk)

Page 15: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

15Katz, Stoica F04

Fluid Flow System

Flows can be served one bit at a time WFQ can be implemented using bit-by-bit weighted

round robin- During each round from each flow that has data to send, send a

number of bits equal to the flow’s weight

Page 16: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

16Katz, Stoica F04

Fluid Flow System: Example 1

1 2 3 4 5

1 2 3 4

1 2 31 2

43 4

55 6

5 6Flow 2(arrival traffic)

Flow 1(arrival traffic)

Servicein fluid flow

system

time

time

time (ms)

Packet Size (bits)

Packet inter-arrival time (ms)

Rate (Kbps)

Flow 1 1000 10 100

Flow 2 500 10 50

100 KbpsFlow 1 (w1 = 1)

Flow 2 (w2 = 1)

0 10 20 30 40 50 60 70 80

Page 17: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

17Katz, Stoica F04

Fluid Flow System: Example 2

0 152 104 6 8

5 1 1 11 1

Red flow has packets backlogged between time 0 and 10

- Backlogged flow flow’s queue not empty

Other flows have packets continuously backlogged

All packets have the same size

flows

link

weights

Page 18: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

18Katz, Stoica F04

Implementation In Packet System

Packet (Real) system: packet transmission cannot be preempted. Why?

Solution: serve packets in the order in which they would have finished being transmitted in the fluid flow system

Page 19: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

19Katz, Stoica F04

Packet System: Example 1

1 2 1 3 2 3 4 4 55 6Packetsystem time

1 2 31 2

43 4

55 6

Servicein fluid flow

system time (ms)

Select the first packet that finishes in the fluid flow system

Page 20: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

20Katz, Stoica F04

Packet System: Example 2

0 2 104 6 8

0 2 104 6 8

Select the first packet that finishes in the fluid flow system

Servicein fluid flow

system

Packetsystem

Page 21: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

21Katz, Stoica F04

Implementation Challenge

Need to compute the finish time of a packet in the fluid flow system…

… but the finish time may change as new packets arrive!

Need to update the finish times of all packets that are in service in the fluid flow system when a new packet arrives

- But this is very expensive; a high speed router may need to handle hundred of thousands of flows!

Page 22: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

22Katz, Stoica F04

Example

Four flows, each with weight 1

Flow 1

time

time

ε

time

time

Flow 2

Flow 3

Flow 4

0 1 2 3

Finish times computed at time 0

time

time

Finish times re-computed at time ε

0 1 2 3 4

Page 23: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

23Katz, Stoica F04

Solution: Virtual Time

Key Observation: while the finish times of packets may change when a new packet arrives, the order in which packets finish doesn’t!

- Only the order is important for scheduling

Solution: instead of the packet finish time maintain the number of rounds needed to send the remaining bits of the packet (virtual finishing time)

- Virtual finishing time doesn’t change when the packet arrives

System virtual time – index of the round in the bit-by-bit round robin scheme

Page 24: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

24Katz, Stoica F04

System Virtual Time: V(t) Measure service, instead of time V(t) slope – normalized rate at which every backlogged flow receives

service in the fluid flow system- C – link capacity- N(t) – total weight of backlogged flows in fluid flow system at time t

1 23

1 24

3 45

5 6Servicein fluid flow

systemtime

time

V(t)

)(

)(

tN

C

t

tV

Page 25: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

25Katz, Stoica F04

System Virtual Time (V(t)): Example 1

V(t) increases inversely proportionally to the sum of the weights of the backlogged flows

1 2 31 2

43 4

55 6

Flow 2 (w2 = 1)

Flow 1 (w1 = 1)

time

time

C

C/2V(t)

Page 26: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

26Katz, Stoica F04

System Virtual Time: Example

0 4 128 16

w1 = 4

w2 = 1

w3 = 1

w4 = 1w5 = 1

C/4

C/8C/4V(t)

Page 27: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

27Katz, Stoica F04

Fair Queueing Implementation

Define- - virtual finishing time of packet k of flow i

- - arrival time of packet k of flow i

- - length of packet k of flow i

- wi – weight of flow i

The finishing time of packet k+1 of flow i is

kiL

kia

kiF

111 )),(max( ki

ki

ki

ki LFaVF / wi

Page 28: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

28Katz, Stoica F04

Properties of WFQ

Guarantee that any packet is transmitted within packet_lengt/link_capacity of its transmission time in the fluid flow system

- Can be used to provide guaranteed services

Achieve max-min fair allocation- Can be used to protect well-behaved flows against

malicious flows

Page 29: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

29Katz, Stoica F04

Outline

QoS guarantees Link sharing Service curve (short)

Page 30: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

30Katz, Stoica F04

Hierarchical Link Sharing

Resource contention/sharing at different levels

Resource management policies should be set at different levels, by different entities

- Resource owner

- Service providers

- Organizations

- Applications

Link

Provider 1

seminar video

Math

Stanford.Berkeley

Provider 2

WEB

155 Mbps

50 Mbps50 Mbps

10 Mbps20 Mbps

100 Mbps 55 Mbps

Campus

seminar audio

EECS

Page 31: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

31Katz, Stoica F04

Hierarchical WFQ (H-WFQ) Example

4 1

1 11 1

Red session has packets backlogged at time 5

Other sessions have packets continuously backlogged

5

0 10 20

10

1

First red packet arrives at 5 …and it is served at 7.5

Servicein fluid flow

system

Page 32: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

32Katz, Stoica F04

Packet Approximation of H-WFQ

Idea 1- Select packet finishing first in H-

WFQ assuming there are no future arrivals

- Problem:

• Finish order in system dependent on future arrivals

• Virtual time implementation won’t work

Idea 2- Use a hierarchy of WFQ to

approximate H-WFQ

6 4

321

WFQ WFQ WFQ

WFQ WFQ

WFQ

10

Packetized H-WFQFluid Flow H-WFQ

6 4

321

WFQ WFQ WFQ

WFQ WFQ

WFQ

10

Page 33: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

33Katz, Stoica F04

Problems with Idea 1

The order of the 4th blue packet finish time and of the first green packet finish time changes as a result of a red packet arrival

Make decision here

Blue packet finish first

Green packet finish first4 1

1 11 1

5

10

1

Page 34: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

34Katz, Stoica F04

Problem with Idea 2

A packet on the second level can miss its deadline (finish time)

4 1

1 11 1

5

10

1

First red packet arrives at 5 …but it is served at 11 !

First level packet schedule

Second level packet schedule

Page 35: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

35Katz, Stoica F04

Solution

Hierarchical-WFQ with a better implementation of WFQ, called Worst-Case Weighted Fair Queueing (WF2Q)

Main idea of WF2Q- Consider for scheduling only eligible packets

- Eligible packet at time t: a packet that has started being serviced in the fluid flow system at time t

Page 36: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

36Katz, Stoica F04

Example

Fluid-Flow System

WFQ (smallest finish time first)

WF2Q (smallest eligible finish time first)

Page 37: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

37Katz, Stoica F04

Hierarchical-WF2Q Example

In WF2Q, all packets meet their deadlines modulo time to transmit a packet (at the line speed) at each level

4 1

1 11 1

5

10

1

First red packet arrives at 5 ..and it is served at 7

First level packet schedule

Second level packet schedule

Page 38: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

38Katz, Stoica F04

Outline

QoS guarantees Link sharing Service curve (short)

Page 39: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

39Katz, Stoica F04

Bandwidth-Delay Coupling

Assume- An arrival curve specified by token bucket (R, r, b) - A reservation request (rmin, D), where rmin – minimum bandwidth, D – maximum delay

WFQ can be inefficient: to satisfy delay D, the allocated rate ra may need to be much higher than r !

bits

b*R/(R-r)

slope rArrival curve

slope ra

D

Page 40: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

40Katz, Stoica F04

Example

End-host: request a worst-case delay D=10ms for a flow characterized by token bucket (R=1Mbps, b=10Kb, r=100Kbps)

Router: allocate rate ra, where

Thus, the router needs to allocate to the flow more than 5 times its average rate r !

ra = b*R / (D*(R-r) + b) = 0.52Mbps

Page 41: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

41Katz, Stoica F04

Solution: Service Curve

Generalize the service allocated to a flow- Assume a flow that is idle at time s and it is backlogged

during the interval (s, t)- Service curve: the minimum service received by the flow

during the interval (s, t)

t

S (t) = service curve

Arrival Curve

D

B

bits

WFQ implements a linear service curve

Page 42: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

42Katz, Stoica F04

Linear Service Curves: Example

t

bits

t

bits

t

Arrival traffic

t

bits

t t

bitsbits

bits

Service curves

Arrival process

Service

VideoFTP

t

Video packets have to wait after ftp packets

Page 43: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

43Katz, Stoica F04

Non-Linear Service Curves: Example

t

bits

t

bits

t

Arrival traffic

t

bits

t t

bitsbits

bits

Service curves

Arrival process

Service

t

Video FTP

Video packets transmittedas soon as they arrive

Page 44: EECS 122:  Introduction to Computer Networks  Packet Scheduling and QoS

44Katz, Stoica F04

What You Need to Know

Basic concepts- Arrival & service curve- Token-bucket specification- System virtual time / finish virtual time- WFQ properties - Link sharing requirements and challenges- Bandwidth-delay coupling problem

Mechanisms: - WFQ implementation in the fluid flow & packet system

You don’t need to know- Details of WF2Q- How service curve works