Fair Queueing FirstComeFirst Served FIFO Packets are transmitted

  • Slides: 32
Download presentation
Fair Queueing

Fair Queueing

First-Come-First Served (FIFO) • Packets are transmitted in the order of their arrival •

First-Come-First Served (FIFO) • Packets are transmitted in the order of their arrival • Advantage: – Very simple to implement • Disadvantage: – Cannot give different service to different types of connections – Each flow (even with low data rate) can experience long delays 2

Static Priority • • • Also called Head-of-Line (HOL) queueing: – Each traffic flow

Static Priority • • • Also called Head-of-Line (HOL) queueing: – Each traffic flow belong to a class – Each class has a priority – One FIFO queue for each class – Transmit from the highest priority queue with a backlog Advantage: – Simple Disadvantage: – Tends to “starve” the lower priority classes 3

Fair Queueing – Attempts to implement a scheduler that simultaneously serves all flows with

Fair Queueing – Attempts to implement a scheduler that simultaneously serves all flows with a backlog at the same rate – Not easy to implement Fair Queuing in a packet network FIFO Fair Queueing 4

Discussion of Fair Rate Allocation • See class notes 5

Discussion of Fair Rate Allocation • See class notes 5

Fair Scheduling Algorithms • Fair Queueing (FQ), a. k. a as Processor Sharing (PS)

Fair Scheduling Algorithms • Fair Queueing (FQ), a. k. a as Processor Sharing (PS) Objective: Achieve fair rate allocation • Weighted Fair Queueing (WFQ), a. k. a. Generalized Processor Sharing (GPS) Objective: Achieve weighted fair rate allocation Problem: How to realize a fair rate allocation when 1. Traffic is transmitted in packet of variable size 2. Transmission of a packet cannot be interrupted 6

Fair Queuing in packet networks • Approach: 1. Take a fluid-flow view of traffic

Fair Queuing in packet networks • Approach: 1. Take a fluid-flow view of traffic • View output link as a “pipe” with a given width • Transmitted traffic flows like a fluid through the pipe Scheduler can transmit traffic from multiple flows at the same time • Scheduler controls the “output rate” for each flow Output rates are set to satisfy “fairness” • Result is a fluid flow schedule 2. Approximate fluid-flow schedule by a packet-level scheduling algorithm 7

Fair Queuing (FQ): From fluid to packets Packet Size (bits) Packet inter-arrival time (ms)

Fair Queuing (FQ): From fluid to packets Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1 1000 10 100 Flow 2 500 10 50 Flow 1 (f 1 = 1) 100 Kbps Flow 2 (f 2 = 1) Flow 1 (arrival traffic) 1 2 4 5 time Flow 2 (arrival traffic) Service in fluid flow system 3 1 0 10 20 2 30 3 40 4 50 5 60 6 70 time 80 time (ms) 8 Slide from Ion Stoica

Fair Queueing (FQ): From fluid to packets (complete) Packet Size (bits) Packet inter-arrival time

Fair Queueing (FQ): From fluid to packets (complete) Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1 1000 10 100 Flow 2 500 10 50 Flow 1 (f 1 = 1) 100 Kbps Flow 2 (f 2 = 1) Flow 1 (arrival traffic) 1 2 5 time Flow 2 (arrival traffic) Service in fluid flow system 4 3 1 1 0 3 4 3 2 10 2 1 20 6 4 2 30 5 3 40 5 4 50 time 5 60 6 70 80 time (ms) 9

Fair Scheduling (fluid flow) 5000 Flow 2 Flow 1 4000 3000 2000 1000 0

Fair Scheduling (fluid flow) 5000 Flow 2 Flow 1 4000 3000 2000 1000 0 10 20 30 40 50 60 70 80 10

Fair Scheduling (fluid flow) 5000 Flow 2 Flow 1 4000 3000 2000 1000 0

Fair Scheduling (fluid flow) 5000 Flow 2 Flow 1 4000 3000 2000 1000 0 10 20 30 40 50 60 70 80 11

Fair Scheduling (FQ) (fluid flow view) • There are N flows • At any

Fair Scheduling (FQ) (fluid flow view) • There are N flows • At any time t, all backlogged flows are served at the same rate of: where B(t) is the set of backlogged flows at time t C is the capacity of the link § The total rate guarantee to a flow j is: 12

Weighted Fair Scheduling (WFQ) (fluid flow view) • There are N flows with weights

Weighted Fair Scheduling (WFQ) (fluid flow view) • There are N flows with weights f 1 , f 2 , …, f. N • The service given to two backlogged flows is proportional to their weights • At any time t , the rate allocated to a backlogged flow i is: where B(t) is the set of backlogged flows at time t C is the capacity of the link § The total rate guarantee to a flow is: 13

FQ/WFQ Scheduling for Packets (packet-level view) • Packet-level implementation of FQ and WFQ tries

FQ/WFQ Scheduling for Packets (packet-level view) • Packet-level implementation of FQ and WFQ tries to emulate the fluid-flow version • Scheduling decision: Always select the packet that will finish next in the ideal fluid-flow FQ/WFQ system 14

WFQ scheduling (with place holder) Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps)

WFQ scheduling (with place holder) Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1 1000 10 100 Flow 2 500 10 50 Flow 1 (f 1 = 1) 100 Kbps Flow 2 (f 2 = 1) Flow 1 (arrival traffic) 1 2 4 3 5 time Flow 2 (arrival traffic) 1 2 3 4 5 6 time Service in fluid flow system 0 10 20 30 40 50 60 70 80 time (ms) Service in packet system 0 10 20 30 40 50 60 70 80 time (ms)15 1 3 2 1 4 2 3 5 4 5 6

WFQ scheduling (complete) Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1

WFQ scheduling (complete) Packet Size (bits) Packet inter-arrival time (ms) Rate (Kbps) Flow 1 1000 10 100 Flow 2 500 10 50 Flow 1 (f 1 = 1) 100 Kbps Flow 2 (f 2 = 1) Flow 1 (arrival traffic) 1 2 Service in packet system 5 time Flow 2 (arrival traffic) Service in fluid flow system 4 3 1 1 0 1 20 1 2 10 3 4 3 2 10 2 20 5 6 4 2 3 time 5 4 5 6 30 40 50 60 70 3 2 3 4 4 5 5 30 40 50 60 70 80 time (ms) 6 80 time (ms)16 Slide from Ion Stoica

Packet-level Implementation of WFQ Problems to deal with: • The finishing time of a

Packet-level Implementation of WFQ Problems to deal with: • The finishing time of a packet in the fluid-flow system may depend on arrivals after a packet has been selected packet-level version of WFQ cannot be 100% accurate • Once started, packet transmission cannot be preemtped • Implementation: – When a packet arrives, it is assigned a “virtual finishing time” • This is the finishing time in the fluid flow system if the set of backlogged flows does not change after packet arrival – Orders packets in increasing order of virtual finishing times – Compute virtual finishing time with the help of a system virtual time 17

System Virtual Time • B(t) : the set of backlogged flows at time t

System Virtual Time • B(t) : the set of backlogged flows at time t • The rate allocated to a backlogged flow i at time t is or Rate of system virtual time : service that a backlogged flow with weight 1 receives in GPS Rate of 18

WFQ: System Virtual Time • WFQ uses a System Virtual Time which tracks the

WFQ: System Virtual Time • WFQ uses a System Virtual Time which tracks the progress of GPS system • Suppose the times when the set B(t) changes are • Let Bl be the set of backlogged flows in time interval • Then we have • When fewer flows are active, virtual time moves faster 19

WFQ: Implementation • Virtual finish time of k-th packet from flow j • ajk

WFQ: Implementation • Virtual finish time of k-th packet from flow j • ajk is the arrival time and Lkj is thesize of the k-th packet from flow j • Packets are sorted and transmitted in the order of virtual finishing times – Virtual times needs to be computed only at arrival time of packets – must keep track of the busy set Bl 20

WFQ Example (packet level) 5000 4000 Virtual time V(t) Flow 1 (arrival traffic) 1

WFQ Example (packet level) 5000 4000 Virtual time V(t) Flow 1 (arrival traffic) 1 2 Flow 2 (arrival traffic) Time t 0 10 3 4 5 1 2 3 4 5 6 time 20 30 40 50 60 70 time 80 V(t) (x 100) 3000 Fn 1 (x 100) Fn 2 (x 100) 2000 1000 actual 1 2 1 transmission order 0 10 20 time t 0 10 20 30 40 50 60 70 80 3 2 3 4 4 5 30 40 50 60 5 70 6 80 time (ms) 21

WFQ Example (packet level) 5000 4000 Virtual time V(t) Flow 1 (arrival traffic) 1

WFQ Example (packet level) 5000 4000 Virtual time V(t) Flow 1 (arrival traffic) 1 2 Flow 2 (arrival traffic) 3 4 5 1 2 3 4 5 6 time Time t 0 10 20 30 40 50 60 70 80 V(t) 0 10 20 25 30 35 40 45 50 10 20 30 40 50 25 30 35 40 45 50 (x 100) 3000 Fn 1 (x 100) Fn 2 (x 100) 2000 1000 actual 1 2 1 transmission order 0 10 20 time t 0 10 20 30 40 50 60 70 80 3 2 3 4 4 5 30 40 50 60 5 70 6 80 time (ms) 22

Approximations of Fair Queueing • Since the packet implementation of WFQ is complex, packet

Approximations of Fair Queueing • Since the packet implementation of WFQ is complex, packet switches often use approximations: – Weighted Round Robin (WRR) – Virtual Clock (VC) – Many others 23

Weighted Round Robin (WRR) • Simple emulation of GPS – Operates in “rounds” –

Weighted Round Robin (WRR) • Simple emulation of GPS – Operates in “rounds” – Li is the average packet size of flow i • Calculate the number of packets to be served in each round: – For each flow i: xi = wi / Li – x = mini { xi } – For each flow i: packets_per_roundi = xi / x • WRR is a good approximation of GPS if – All flows are active – Over long periods of time 24

Virtual Clock (VC) • Emulates a system with transmissions in periodic intervals • Two

Virtual Clock (VC) • Emulates a system with transmissions in periodic intervals • Two state variables for each flow j: – aux. VCj virtual transmission time of the flow – rj reserved rate • The variable aux. VCj keeps track of hypothetical departure times. If all traffic from flow j is limited to the reserved rate, then aux. VCj is the departure time of an arrival. • Upon arrival of a packet from flow j with size Ljk at time ajk: – aux. VCj = max (aux. VCj , ajk ) + Ljk / rj – Stamp aux. VCj in packet header Packet are transmitted in increasing order of virtual transmission times – 25

Example: Virtual Clock (with place holder) C = 1 Mbps, r 1=r 2=r 3=1/3

Example: Virtual Clock (with place holder) C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000 bits wall clock (ms)= r 1=1/3 0 2 1 3 5 4 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 12 aux. VC 1 r 2=1/3 time aux. VC 2 r 3=1/3 aux. VC 3 Virtual clock order time 1 2 3 4 time (with aux. VCi) 26

Example: Virtual Clock C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000 bits

Example: Virtual Clock C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000 bits wall clock (ms)= 0 r 1=1/3 aux. VC 1= 1 3 r 2=1/3 aux. VC 2 = Virtual clock order (with aux. VCi) 2 6 1 3 3 4 9 2 5 4 5 12 3 15 4 6 6 7 8 9 10 11 12 time 18 5 6 time 3 r 3=1/3 aux. VC 3 = 2 1 6 9 12 1 15 18 2 3 4 time 3 6 1 3 1 3 9 2 6 2 6 12 3 9 3 9 4 12 time 27

Example: Virtual Clock (with place holder) C = 1 Mbps, r 1=r 2=r 3=1/3

Example: Virtual Clock (with place holder) C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000 bits • “aux. VCj = max (aux. VCj , ajk ) + wall clock (ms)= r 1=1/3 0 1 2 Ljk / rj” 3 prevents credit accumulation of idle flows 4 5 6 7 8 9 10 1 2 3 4 aux. VC 1 r 2=1/3 aux. VC 3 Virtual clock order (with aux. VCi) time aux. VC 2 r 3=1/3 11 1 2 3 4 time 28

Example: Virtual Clock (complete) C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000

Example: Virtual Clock (complete) C = 1 Mbps, r 1=r 2=r 3=1/3 Mbps, L=1000 bits • “aux. VCj = max (aux. VCj , ajk ) + wall clock (ms)= 0 r 1=1/3 aux. VC 1 3 1 prevents credit accumulation of idle flows 5 4 6 2 3 r 2=1/3 aux. VC 2 2 1 Ljk / rj” (with aux. VCi) 3 1 3 4 12 9 1 2 6 time 1 aux. VC 3 11 12 9 r 3=1/3 10 4 3 6 Virtual clock order 9 9 2 3 8 3 6 1 7 2 12 1 9 3 15 3 9 4 time 18 3 9 2 12 4 12 3 4 15 18 time 29

Problem with Virtual Clock (with place holder) • Flow that gets more than reserved

Problem with Virtual Clock (with place holder) • Flow that gets more than reserved rate may be penalized in the future 0 r 1=1/3 aux. VC 1= 1 3 2 1 2 6 3 3 9 5 4 4 12 5 15 6 18 r 2=1/3 aux. VC 2 = 7 8 7 21 9 8 10 11 time 24 1 2 3 4 time 8 r 3=1/3 aux. VC 3 = 6 11 1 14 2 17 3 4 time 8 11 14 17 Virtual clock order (with aux. VCi) time 30

Problem with Virtual Clock (with place holder) • Flow that gets more than reserved

Problem with Virtual Clock (with place holder) • Flow that gets more than reserved rate may be penalized in the future 0 r 1=1/3 aux. VC 1= 2 1 1 3 2 3 6 3 5 4 4 9 12 5 15 6 18 r 2=1/3 21 8 9 10 11 8 time 24 2 3 4 time 8 r 3=1/3 11 1 14 2 17 3 4 time aux. VC 3 = (with aux. VCi) 7 7 1 aux. VC 2 = Virtual clock order 6 8 1 2 3 6 3 9 4 12 1 14 17 5 1 1 2 2 3 3 4 15 8 8 11 11 14 14 17 4 6 7 time 17 18 21 time 31 8 2

Problem with Virtual Clock (complete) • Flow that gets more than reserved rate may

Problem with Virtual Clock (complete) • Flow that gets more than reserved rate may be penalized in the future wall clock (ms)= 0 1 2 3 4 5 6 7 8 9 10 11 32