6 829 Computer Networks Lecture 5 Scheduling Isolation















![Packet vs. “Fluid” System Bit-by-bit FQ is not implementable [why? ] – Multiple queues/packets Packet vs. “Fluid” System Bit-by-bit FQ is not implementable [why? ] – Multiple queues/packets](https://slidetodoc.com/presentation_image_h2/e68401998cae5afb7f4ea86636f03e8f/image-16.jpg)




![Implementing WFQ Challenge: Determining finish time for GPS is hard [Why? ] Idea: Don’t Implementing WFQ Challenge: Determining finish time for GPS is hard [Why? ] Idea: Don’t](https://slidetodoc.com/presentation_image_h2/e68401998cae5afb7f4ea86636f03e8f/image-21.jpg)








- Slides: 29
6. 829 Computer Networks Lecture 5: Scheduling, Isolation, and Fairness Mohammad Alizadeh Fall 2016 Some slides based on lectures by: Nick Mc. Keown (nickm@cs. stanford. edu), and Ion Stoica (istoica@cs. berkeley. edu) 1
Recap of last time Buffer management – – When and which packet to drop? Drop-tail: large delays, synchronization RED: Early probabilistic dropping PI: Decouple queue length & number of flows Explicit congestion control – ECN: “slow down!” (binary feedback) – XCP: “increase/decrease by …” (multi-bit feedback)
Max-Min Fairness A common way to allocate flows 8 10 10 2 f = 4: min(8, 4) = 4 min(10, 4) = 4 min(2, 4) = 2 4 4 2 Rate Demanded/Allocated 1. Allocate in order of increasing demand 2. No flow gets more than demand 3. The excess, if any, is equally shared 10 8 2 2 4 2 Flows sorted by demand Total = 10 Total = 6 3
XCP: An e. Xplicit Control Protocol 1. Efficiency Controller 2. Fairness Controller ² Credit: Dina Katabi (MIT)
How Does an XCP Router Compute the Feedback? Efficiency Controller Fairness Controller Goal: Matches input traffic to link capacity & drains the queue Goal: Divides between flows to converge to fairness Looks at aggregate traffic & queue Looks at a flow’s state in Congestion Header Algorithm: Aggregate traffic changes by ~ Spare Bandwidth ~ - Queue Size So, = davg Spare - Queue Algorithm: If > 0 Divide equally between flows If < 0 Divide between flows proportionally to their current rates ² Credit: Dina Katabi (MIT)
Packet Scheduling In what order are packets sent – “Work-conserving” – e. g. , FCFS, priorities, weighted fair-queueing At what time are packets sent – “Non-work-conserving” – e. g. , Token bucket shaping 6
Weighted Fair Queueing A scheduling algorithm for (weighted) max-min fairness – Decides which flow’s packet to send next Link 1, ingress Link 1, egress Link 2, ingress Link 2, egress Classifier Link 3, ingress ² Credit: Nick Mc. Keown (Stanford) Link 3, egress flow 1 flow 2 Scheduler flow n 7
Properties of WFQ Work conserving – Link is busy if there are packets to send Max-min fair allocation of bandwidth Provides isolation – Behavior of one sender does not impact another – Traffic hogs cannot overrun others End-to-end delay bounds for guaranteed service 8
Bandwidth vs Delay Guarantees A 0. 1 Mb/s Voice call 1 Mb/s C 1 Mb/s B Time-scale of bw guarantee critical for delay 1/7 Mb/s Mon Tue Wed Thu Fri Sat Sun Mon 9
Classic Papers Thousands of citations; several best paper awards; on nearly every “must-read networking papers” list… 10
Outline for Rest of Today Bit-by-bit Fair Queuing (“fluid” system) Packet-by-packet Fair Queuing (aka. WFQ) Implementing WFQ 11
Bit-by-Bit Fair Queueing 1. Packets belonging to a flow are placed in a FIFO. Question: This is called “per-flow What is a queueing”. “flow”? 2. FIFOs are scheduled one bit at a time, in a round-robin How fashion. Question: can we give weights? Flow 1 Bit-by-bit round robin Classification * Slide by Nick Mckeown nickm@cs. stanford. edu Flow N 12
Bit-by-Bit Weighted Fair Queueing Flows can be allocated different rates by servicing a different number of bits for each flow during each round. w 1 = 0. 1 w 2 = 0. 3 w 3 = 0. 3 w 4 = 0. 3 R 1 1 C Order of service for the four queues: … f 1, f 2, f 3, f 4, f 1, … Generalized Processor Sharing (GPS): “infinitesimal amount of flow” instead of “bits” * Slide by Nick Mckeown (nickm@cs. stanford. edu) 13
GPS Example • Red flow backlogged between time 0 and 10 Question: link Is this max-min fair? • Other flows continuously backlogged 0 2 * Slide by Ion Stoica istoica@cs. berkeley. edu flows 5 4 6 8 1 10 1 1 15 14
Outline Bit-by-bit Fair Queuing (“fluid” system) Packet-by-packet Fair Queuing (aka. WFQ) Implementing WFQ 15
Packet vs. “Fluid” System Bit-by-bit FQ is not implementable [why? ] – Multiple queues/packets can be serviced simultaneously In real packet-based systems – One queue is served at any given time – Packet transmission cannot be preempted Goal: A packet scheme close to fluid system – Bound performance w. r. t fluid system 16
First Cut: Simple Round Robin Serve a packet from non-empty queues in turn – Lets assume all flows have equal weight [Is this fair? ] Variable packet length can get more service by sending bigger packets Unfair instantaneous service rate (esp. with variable weights) – E. g. 500 flows: 250 with weight 1, 250 with weight 10 – Each round takes 2, 750 packet times – What if a packet arrives right after its “turn”? 17
Packet-by-packet Fair Queuing (Weighted Fair Queuing) Deals better with variable size packets and weights Key Idea: 1. Determine the finish time of packets in bit-by-bit system (GPS), assuming no more arrivals 2. Serve packets in order of finish times Theorem: 18
Intuition for Bound Finishing order of packets currently in fluid system is independent of future arrivals [why? ] A packet is delayed more in packet system only if when it arrives, a packet that finishes later in the fluid system is already being transmitted There can be at most one such packet 19
Outline GPS (“fluid” system) Packet-by-packet GPS (aka. WFQ) Implementing WFQ 20
Implementing WFQ Challenge: Determining finish time for GPS is hard [Why? ] Idea: Don’t need finish time. Need finish order. The finish order is a lot easier to calculate. 21
Finish order In what order do the packets finish? Increasing Li/wi w 1 = 0. 1 L 1 w 2 = 0. 3 L 2 w 3 = 0. 3 w 4 = 0. 3 R 1 L 3 L 4 1 C Order of service for the four queues: … f 1, f 2, f 3, f 4, f 1, … Does not change with future packet arrivals! 22
Bit-by-bit System Round ww 11 ==0. 1 1 L 1 ww 22 ==0. 3 3 L 2 ww 33 ==0. 3 3 ww 44==0. 3 3 R 1 L 3 L 4 1 C Order of service for the four queues: … f 1, f 2, f 3, f 4, f 1, … Round – One complete cycle through all the queues sending wi bits per qeueue Question: How R(t) = # of rounds at time t long. C does a round take? = link rate B(t) = set of backlogged flows 23
Bit-by-bit System Round ww 11 ==0. 1 1 L 1 ww 22 ==0. 3 3 L 2 ww 33 ==0. 3 3 ww 44==0. 3 3 R 1 L 3 L 4 1 C Order of service for the four queues: … f 1, f 2, f 3, f 4, f 1, … Round – One complete cycle through all the queues sending wi bits per qeueue Question: How many rounds does it take to of length L takes L/wflow i rounds serve. Packet a packet of length L from i? to serve 24
Round vs Time 1/2 1/8 1/8 2*C C 2*C 0 4 * Based on slide by Ion Stoica istoica@cs. berkeley. edu 8 12 16 25
Round (aka. “Virtual Time”) Implementation of WFQ Assign a start/finish round to each packet at arrival serve packets finishof rounds Question: Whatinisorder finishofround kth packet – Fik? Suppose kth packet of flow i arrives at time a Start round of kth packet Finish round of (k-1)th packet k k-1 …… (Flow i backlogged) k Round number at time a (Flow i empty) 26
Putting it All Together For kth packet of flow i arriving at time a: Question: How to compute R(a)? Simple approximation: Set R(a) to start or finish round of packet currently in service 27
Summary of WFQ Pros – Excellent approximation of GPS – Preserves good properties of GPS: isolation, rate and delay guarantees – Gives users incentive to use intelligent flow control Cons – Needs per-flow queues (potentially millions) – Requires sorting packets by virtual finish time – Virtual time hard to implement exactly 28
29