# 1 scheduling: buffer management. # 2 the setting

70
# 1 Scheduling: Buffer Management

Post on 18-Dec-2015

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: # 1 Scheduling: Buffer Management. # 2 The setting

# 1

Scheduling:Buffer Management

Page 2: # 1 Scheduling: Buffer Management. # 2 The setting

# 2

The setting

Page 3: # 1 Scheduling: Buffer Management. # 2 The setting

# 3

Buffer Scheduling Who to send next? What happens when buffer is full? Who to discard?

Page 4: # 1 Scheduling: Buffer Management. # 2 The setting

# 4

Requirements of scheduling

An ideal scheduling discipline is easy to implement is fair and protective provides performance bounds

Each scheduling discipline makes a different trade-off among these requirements

Page 5: # 1 Scheduling: Buffer Management. # 2 The setting

# 5

Ease of implementation

Scheduling discipline has to make a decision once every few microseconds!

Should be implementable in a few instructions or hardware for hardware: critical constraint is VLSI space Complexity of enqueue + dequeue processes

Work per packet should scale less than linearly with number of active connections

Page 6: # 1 Scheduling: Buffer Management. # 2 The setting

# 6

Fairness

Intuitivelyeach connection should get no more than its

demandthe excess, if any, is equally shared

But it also provides protectiontraffic hogs cannot overrun othersautomatically isolates heavy users

Page 7: # 1 Scheduling: Buffer Management. # 2 The setting

# 7

Max-min Fairness: Single Buffer

Allocate bandwidth equally among all users If anyone doesn’t need its share, redistribute maximize the minimum bandwidth provided to any

flow not receiving its request To increase the smallest need to take from larger. Consider fluid example. Ex: Compute the max-min fair allocation for a set of

four sources with demands 2, 2.6, 4, 5 when the resource has a capacity of 10.

• s1= 2; • s2= 2.6; • s3 = s4= 2.7

More complicated in a network.

Page 8: # 1 Scheduling: Buffer Management. # 2 The setting

# 8

FCFS / FIFO QueuingSimplest Algorithm, widely used.Scheduling is done using first-in first-

out (FIFO) disciplineAll flows are fed into the same queue

Page 9: # 1 Scheduling: Buffer Management. # 2 The setting

# 9

FIFO Queuing (cont’d)

First-In First-Out (FIFO) queuing First Arrival, First Transmission Completely dependent on arrival time No notion of priority or allocated buffers No space in queue, packet discarded Flows can interfere with each other; No

isolation; malicious monopolization; Various hacks for priority, random drops,...

Page 10: # 1 Scheduling: Buffer Management. # 2 The setting

# 10

Priority Queuing A priority index is assigned to each packet upon arrival Packets transmitted in ascending order of priority index.

Priority 0 through n-1 Priority 0 is always serviced first

Priority i is serviced only if 0 through i-1 are empty Highest priority has the

lowest delay, highest throughput, lowest loss

Lower priority classes may be starved by higher priority Preemptive and non-preemptive versions.

Page 11: # 1 Scheduling: Buffer Management. # 2 The setting

# 11

Priority Queuing

Transmission link

Packet discardwhen full

High-prioritypackets

Low-prioritypackets

Packet discardwhen full

When high-priorityqueue empty

Page 12: # 1 Scheduling: Buffer Management. # 2 The setting

# 12

Round Robin: Architecture

Flow 1

Flow 3

Flow 2

Transmission link

Round robin

Hardware requirement: Jump to next non-empty queue

Round Robin: scan class queues serving one from each class that has a non-empty queue

Page 13: # 1 Scheduling: Buffer Management. # 2 The setting

# 13

Round Robin Scheduling Round Robin: scan class queues serving one

from each class that has a non-empty queue

Page 14: # 1 Scheduling: Buffer Management. # 2 The setting

# 14

Round Robin (cont’d) Characteristics:

Classify incoming traffic into flows (source-destination pairs)

Round-robin among flows Problems:

Ignores packet length (GPS, Fair queuing) Inflexible allocation of weights (WRR,WFQ)

Benefits: protection against heavy users (why?)

Page 15: # 1 Scheduling: Buffer Management. # 2 The setting

# 15

Weighted Round-Robin Weighted round-robin

Different weight wi (per flow)

Flow j can sends wj packets in a period.

Period of length wj

Disadvantage Variable packet size. Fair only over time scales longer than a period time.

• If a connection has a small weight, or the number of connections is large, this may lead to long periods of unfairness.

Page 16: # 1 Scheduling: Buffer Management. # 2 The setting

# 16

DRR (Deficit RR) algorithm Choose a quantum of bits to serve from each

connection in order. For each HoL (Head of Line) packet,

credit := credit + quantum if the packet size is ≤ credit; send and save excess, otherwise save entire credit. If no packet to send, reset counter (to remain fair)

Each connection has a deficit counter (to store credits) with initial value zero.

Easier implementation than other fair policies WFQ

Page 17: # 1 Scheduling: Buffer Management. # 2 The setting

# 17

Deficit Round-Robin DRR can handle variable packet size

1500

300

1200

2000 1000

SecondRound

FirstRound

Head ofQueue

A

B

C

0

Quantum size : 1000 byte

1st Round A’s count : 1000 B’s count : 200 (served

twice) C’s count : 1000

2nd Round A’s count : 500 (served) B’s count : 0 C’s count : 800 (served)

500

Page 18: # 1 Scheduling: Buffer Management. # 2 The setting

# 18

DRR: performance

Handles variable length packets fairly Backlogged sources share bandwidth

equally Preferably, packet size < Quantum Simple to implement

Similar to round robin

Page 19: # 1 Scheduling: Buffer Management. # 2 The setting

# 19

Generalized Processor Sharing

Page 20: # 1 Scheduling: Buffer Management. # 2 The setting

# 20

Generalized Process Sharing (GPS)

The methodology: Assume we can send infinitesimal packets

• single bit Perform round robin.

• At the bit level

Idealized policy to split bandwidth GPS is not implementable Used mainly to evaluate and compare real

approaches. Has weights that give relative frequencies.

Page 21: # 1 Scheduling: Buffer Management. # 2 The setting

# 21

GPS: Example 1

GPS examlpe 1

0

10

20

30

40

time

queu

e si

ze A

B

C

50 6030

Packets of size 10, 20 & 30 arrive at time 0

Page 22: # 1 Scheduling: Buffer Management. # 2 The setting

# 22

GPS: Example 2

GPS example 2

0

5

10

15

20

25

time

queu

e si

ze A

B

C

5 15 3040 45

Packets: time 0 size 15 time 5 size 20 time 15 size 10

Page 23: # 1 Scheduling: Buffer Management. # 2 The setting

# 23

GPS: Example 3

GPS examlpe 3

0

5

10

15

20

25

time

queu

e si

ze A

B

C

5 15 30 45 60

Packets: time 0 size 15 time 5 size 20 time 15 size 10time 18 size 15

Page 24: # 1 Scheduling: Buffer Management. # 2 The setting

# 24

GPS : Adding weights

Flow j has weight wj

The output rate of flow j, Rj(t) obeys:

For the un-weighted case (wj=1):

)(

' )()(tACTIVEk k

jjj w

wtR

dt

dtR

|)(|

1)()('

tACTIVEtR

dt

dtR jj

Page 25: # 1 Scheduling: Buffer Management. # 2 The setting

# 25

Non-backlogged connections, receive what they ask for.

Backlogged connections share the remaining bandwidth in proportion to the assigned weights.

Every backlogged connection i, receives a service rate of :

Fairness using GPS

)(

)('tACTIVEj j

i

w

wi tR Active(t): the set of

backlogged flows at time t

Page 26: # 1 Scheduling: Buffer Management. # 2 The setting

# 26

GPS: Measuring unfairness

No packet discipline can be as fair as GPS while a packet is being served, we are unfair to

others Degree of unfairness can be bounded Define: workA (i,a,b) = # bits transmitted for flow i in

time [a,b] by policy A. Absolute fairness bound for policy S

Max (workGPS(i,a,b) - workS(i, a,b)) Relative fairness bound for policy S

Max (workS(i,a,b) - workS(j,a,b))assuming both i and j are backlogged in [a,b]

Page 27: # 1 Scheduling: Buffer Management. # 2 The setting

# 27

GPS: Measuring unfairness

Assume fixed packet size and round robin Relative bound: 1 Absolute bound: 1-1/n

n is the number of flows Challenge: handle variable size packets.

Page 28: # 1 Scheduling: Buffer Management. # 2 The setting

# 28

Weighted Fair Queueing

Page 29: # 1 Scheduling: Buffer Management. # 2 The setting

# 29

GPS to WFQ

We can’t implement GPS So, lets see how to emulate it We want to be as fair as possible But also have an efficient implementation

Page 30: # 1 Scheduling: Buffer Management. # 2 The setting

# 30

Page 31: # 1 Scheduling: Buffer Management. # 2 The setting

# 31

Queue 1@ t=0

Queue 2@ t=0

GPS:both packets served at rate 1/2

Both packets complete service at t=2

t

1

1 20

Packet-by-packet system (WFQ):queue 1 served first at rate 1;then queue 2 served at rate 1.

Packet fromqueue 1 beingserved

Packet from queue 2being served

Packet fromqueue 2 waiting

1

t1 20

GPS vs WFQ (equal length)

Page 32: # 1 Scheduling: Buffer Management. # 2 The setting

# 32

Queue 1@ t=0

Queue 2@ t=0

2

1

t30

2

Packet from queue2 served at rate 1

GPS: both packets served at rate 1/2

queue 2 served at rate 1

Packet fromqueue 1 beingserved at rate 1

Packet fromqueue 2 waiting

1

t1 20 3

GPS vs WFQ (different length)

Page 33: # 1 Scheduling: Buffer Management. # 2 The setting

# 33

Queue 1@ t=0

Queue 2@ t=0

1

t1 20

WFQ: queue 2 served first at rate 1;then queue 1 served at rate 1.

Packet from queue 1being served

Packet fromqueue 2 beingserved

Packet fromqueue 1 waiting

1

t1 20

GPS: packet from queue 1served at rate 1/4;

Packet from queue 2served at rate 3/4

GPS vs WFQ

Weight:

Queue 1=1 Queue 2 =3

Packet from queue 1 served at rate 1

Page 34: # 1 Scheduling: Buffer Management. # 2 The setting

# 34

Completion times

Emulating a policy: Assign each packet p a value time(p). Send packets in order of time(p).

FIFO: Arrival of a packet p from flow j:

last = last + size(p);time(p)=last;

perfect emulation...

Page 35: # 1 Scheduling: Buffer Management. # 2 The setting

# 35

Round Robin Emulation

Round Robin (equal size packets) Arrival of packet p from flow j: last(j) = last(j)+ 1; time(p)=last(j); Idle queue not handle properly!!!

Sending packet q: round = time(q) Arrival: last(j) = max{round,last(j)}+ 1 time(p)=last(j);

What kind of low level scheduling?

Page 36: # 1 Scheduling: Buffer Management. # 2 The setting

# 36

Round Robin Emulation

Round Robin (equal size packets) Sending packet q: round = time(q); flow_num = flow(q); Arrival: last(j) = max{round,last(j) } IF (j =< flow_num) & (last(j)=round)

THEN last(j)=last(j)+1 time(p)=last(j);

What kind of low level scheduling?

Page 37: # 1 Scheduling: Buffer Management. # 2 The setting

# 37

GPS emulation (WFQ)

Arrival of p from flow j: last(j)= max{last(j), round} + size(p); using weights:last(j)= max{last(j), round} + size(p)/wj;

How should we compute the round? We like to simulate GPS: x is the period of time in which #active did

not change round(t+x) = round(t) + x/B(t) B(t) = # active flows

A flow j is active while round(t) < last(j)

Page 38: # 1 Scheduling: Buffer Management. # 2 The setting

# 38

WFQ: Example (GPS view)

1

t1 20 3 4

½

round1/2 5/60 7/6 11/6

Note that if in a time interval round progresses by amount xThen every non-empty buffer is emptied by amount x during the interval

Page 39: # 1 Scheduling: Buffer Management. # 2 The setting

# 39

WFQ: Example (equal size)Time 0: packets arrive to flow 1 & 2.last(1)= 1; last(2)= 1; Active = 2round (0) =0; send 1

Time 1: A packet arrives to flow 3round(1) = 1/2; Active = 3last(3) = 3/2; send 2Time 2: A packet arrives to flow 4.round(2) = 5/6; Active = 4 last(4) = 11/6; send 3

Time 2+2/3: round = 1; Active = 2Time 3 : round = 7/6 ; send 4; Time 3+2/3: round = 3/2; Active = 1Time 4 : round = 11/6 ; Active=0

Page 40: # 1 Scheduling: Buffer Management. # 2 The setting

# 40

WFQ: Example (GPS view)

1

t1 20 3 4

½

round1/2 5/60 7/6 11/6

Note that if in a time interval round progresses by amount xThen every non-empty buffer is emptied by amount x during the interval

Page 41: # 1 Scheduling: Buffer Management. # 2 The setting

# 41

Worst Case Fair Weighted Fair Queuing (WF2Q)

Page 42: # 1 Scheduling: Buffer Management. # 2 The setting

# 42

Worst Case Fair Weighted Fair Queuing (WF2Q)

WF2Q fixes an unfairness problem in WFQ. WFQ: among packets waiting in the system,

pick one that will finish service first under GPS

WF2Q: among packets waiting in the system, that have started service under GPS, select one that will finish service first GPS

WF2Q provides service closer to GPS difference in packet service time bounded by

max. packet size.

Page 43: # 1 Scheduling: Buffer Management. # 2 The setting

# 43

Page 44: # 1 Scheduling: Buffer Management. # 2 The setting

# 44

Page 45: # 1 Scheduling: Buffer Management. # 2 The setting

# 45

Page 46: # 1 Scheduling: Buffer Management. # 2 The setting

# 46

Page 47: # 1 Scheduling: Buffer Management. # 2 The setting

# 47

Multiple Buffers

Page 48: # 1 Scheduling: Buffer Management. # 2 The setting

# 48

Buffers

Input ports Output ports Inside fabric Shared Memory Combination of all

Buffer locations

Fabric

Page 49: # 1 Scheduling: Buffer Management. # 2 The setting

# 49

Input Queuing

fabric

Inp

uts

Outp

uts

Page 50: # 1 Scheduling: Buffer Management. # 2 The setting

# 50

• Input speed of queue – no more than input line• Need arbiter (running N times faster than

input)• FIFO queue • Head of Line (HoL) blocking .• Utilization:

• Random destination• 1- 1/e = 59% utilization

• due to HoL blocking

Input Buffer : properties

Page 51: # 1 Scheduling: Buffer Management. # 2 The setting

# 51

Head of Line Blocking

Page 52: # 1 Scheduling: Buffer Management. # 2 The setting

# 52

Page 53: # 1 Scheduling: Buffer Management. # 2 The setting

# 53

Page 54: # 1 Scheduling: Buffer Management. # 2 The setting

# 54

Head of Line Blocking

Stadium

Beer/Soda/Chips

Kwiky Mart

Page 55: # 1 Scheduling: Buffer Management. # 2 The setting

# 55

Stadium

Output Queuing

Beer/Soda/Chips

Kwiky Mart

Page 56: # 1 Scheduling: Buffer Management. # 2 The setting

# 56

Head of Line Blocking

BCACB

A

B

C

Page 57: # 1 Scheduling: Buffer Management. # 2 The setting

# 57

Head of Line Blocking

BCACBCAB

A

B

C

Page 58: # 1 Scheduling: Buffer Management. # 2 The setting

# 58

Head of Line Blocking

CB CBCABCB A

A

B

C

Page 59: # 1 Scheduling: Buffer Management. # 2 The setting

# 59

A

B

C

VOQ—Virtual Output Queues

BCACB

ARB

Page 60: # 1 Scheduling: Buffer Management. # 2 The setting

# 60

VOQ—Virtual Output Queues

B

C

AA

A

B

C

ARB

CBCAB

Page 61: # 1 Scheduling: Buffer Management. # 2 The setting

# 61

VOQ—Virtual Output Queues

B

C

A

BACCB

AAA

A

B

C

ARB

Page 62: # 1 Scheduling: Buffer Management. # 2 The setting

# 62

Performance Issue with Cross-Bars

Source: M. J. Karol, M.G. Hluchyj, S. P. Morgan, “Input Versus Output Queueing [sic] on a Space-Division Packet Switch”, IEEE Transactions on Communications, Vol COM-35, No 12, December 1987, page 1353

58.6%

Page 63: # 1 Scheduling: Buffer Management. # 2 The setting

# 63

The fabric looks ahead into the input buffer for packets that may be transferred if they were not blocked by the head of line.

Improvement depends on the depth of the look ahead.

This corresponds to virtual output queues where each input port has buffer for each output port.

Overcoming HoL blocking: look-ahead

Page 64: # 1 Scheduling: Buffer Management. # 2 The setting

# 64

Input QueuingVirtual output queues

Page 65: # 1 Scheduling: Buffer Management. # 2 The setting

# 65

Each output port is expanded to L output ports

The fabric can transfer up to L packets to the same output instead of one cell.

Overcoming HoL blocking: output expansion

Karol and Morgan, IEEE transaction on communication, 1987: 1347-1356

Page 66: # 1 Scheduling: Buffer Management. # 2 The setting

# 66

fabric

L

Input Queuing Output Expansion

Page 67: # 1 Scheduling: Buffer Management. # 2 The setting

# 67

Output QueuingThe “ideal”

1

1

1

1

1

1

1

1

1

11

1

2

2

2

2

2

2

Page 68: # 1 Scheduling: Buffer Management. # 2 The setting

# 68

Output Buffer : properties

No HoL problem Output queue needs to run faster than input lines Need to provide for N packets arriving to same

queue solution: limit the number of input lines that can

be destined to the output.

Page 69: # 1 Scheduling: Buffer Management. # 2 The setting

# 69

Shared Memory

a common pool of buffers divided into

linked lists indexed by output port number

FAB

RIC

FAB

RIC

MEMORY

Page 70: # 1 Scheduling: Buffer Management. # 2 The setting

# 70

Shared Memory: properties

• Packets stored in memory as they arrive• Resource sharing• Easy to implement priorities• Memory is accessed at speed equal to sum of

the input or output speeds• How to divide the space between the sessions