Packet Scheduling: SCFQ, STFQ, WF2Q Yongho Seok Contents • Review: GPS, PGPS • SCFQ( Self-clocked fair queuing ) • STFQ( Start time fair queuing ) • WF2Q( Worst-case fair weighted fair queuing ) • Conclusion GPS • An idealized policy that can split bandwidth among multiple sessions simultaneously – Each session I has a queue and a weight i – At time t, GPS serves all non-empty queues simultaneously in proportion to ri (t ) i jB ( t ) – Property j GPS(Cont’) • Observation : – Guaranteed service rate for session j whenever it becomes backlogged • Another View – Weighted round robin with infinitely small service amount PGPS • Intuition – Compute the time a packet would complete service had we been serving packets with a GPS server, then serve packets in order of these finishing times – emulates GPS “on the side” and uses the results of this simulation to determine service order • Three virtual times – Not real time, but time for representing the amount of service – Virtual Star time, Virtual Finish time : each flow – Virtual System time : system-wide time PGPS(Cont’) Virtual Start Time Si (t ) max{V (t ), Fi 1 (t )} Virtual Finish Time Fi (t ) Si (t ) Li k i Virtual Time Implementation of WFQ V (0) 0 V (t j 1 ) V (t j 1 ) C iB j i t j t j 1 , j 2,3,... PGPS(Cont’) Si (t1 , t2 ) i S k (t1 , t2 ) k S j (t1 , t2 ) j ri (t ) (t2 t1 ) i k k jB ( t ) rk (t ) (t2 t1 ) S k (t1 , t2 ) j jB ( t ) C jB ( t ) i C ri (t ) j C j C jB ( t ) j If C=1 and Si (t1 , t 2 ) Lki , then This packet finish service after virtual time Lki i WFQ : Scheduling Example • Situation – Three sessions : A, B, and C – Time 0 : packets of size 1(A), 2(B), and 2(C) arrives – Time 4 : a packet of size 2(A) arrives • Assumption – Weight are all same – Link Capacity C = 1 Result comparison(GPS, WFQ) GPS 0 3 5.5 6 4 7 WFQ 0 1 3 5 7 A B,C V(t) 3.5 3 Virtual Time 2.5 2 1.5 1 F(0) = Max(0,0) + 2 =2 F(0) = Max(0,0) + 1 =1 0.5 0 Slope = C / weighted sum of backlogged flows = 1/3 1 2 3 4 5 6 Real Time(At time 0) 7 8 A B,C V(t) 3.5 3 Virtual Time 2.5 2 1.5 1 Flow A is unbacklogged in WFQ at time 1 Flow A is unbacklogged in GPS at time 3 0.5 0 1 2 3 4 5 6 Real Time(AT time 3) 7 8 2nd packet of size 2 arrives 3.5 A B,C V(t) F(4) = Max(1.5,1) + 2 = 3.5 3 Virtual Time 2.5 2 1.5 Slope = 1/2 1 0.5 0 1 2 3 4 5 6 Real Time(At time 4) 7 8 A B,C V(t) 3.5 3 Virtual Time 2.5 Flow B or C is unbacklogged in GPS at time 5.5 2 Slope = 1/3 1.5 1 0.5 0 1 2 3 4 5 6 Real Time(At time 5.5) 7 8 A B,C V(t) 3.5 3 Virtual Time Slope = 1 2.5 2 1.5 1 0.5 0 1 2 3 4 5 6 Real Time(At time 7) 7 8 Fairness of WFQ • The difference between GPS and WFQ • Cannot fall behind GPS by one packet • One Packet difference means • Problem – Cannot fall behind GPS by one packet, however, can fall ahead GPS by infinite amount – Motivation of WF2Q Self-Clocked Fair Queuing (SCFQ) • Same as WFQ except Si (t ) max{CF, Fi 1 (t )} k Li Fi (t ) Si (t ) i • CF : the virtual finish time of the packet currently in service • Easier to implement than WFQ Relative Fairness & Absolute Fairness • The service rate allocated to connection I at the kth switch on its path from source to its destination g (i, k ) (i, k )r (k ) ( j, k ) • Relative Fairness RFB | S (i, , t ) S ( j, , t ) | g (i ) g ( j) • Absolute Fairness AFB | S (i, , t ) G ( j, , t ) | g (i ) g (i ) Fairness of SCFQ • The author has shown that the relative fairness bound for SCFQ is RFB Pmax (i ) Pmax ( j ) g (i ) g ( j) • But, the absolute fairness bounded for SCFQ is currently unknown • Although the SCFQ round number update rule is easy to implement, it can be unfair over short term scales Fairness of SCFQ(Cont’) • Worst-case latency for SCFQ is Pmax (i ) P ( N 1) max g (i ) r compared to Pmax (i ) Pmax g (i ) r for WFQ • STFQ improve a large worst case delay and shortterm unfairness Start-time Fair Queuing (STFQ) Same as WFQ except Si (t ) max{SF, Fi 1 (t )} k Li Fi (t ) Si (t ) i SF : the virtual start time of the packet currently in service Serves the packet having smallest virtual start time Easier to implement than WFQ Note Worst-case Fair Weighted Fair Queuing (WF2Q) • Conceptually, – S(t) : the total amount of service received by flow I – V(t) : the total amount of service , which would be received in GPS • WF2Q algorithm – WFQ scheduling + eligibility test – eligible test V (t ) Si (t ) • Among packets that have started service under GPS, pick the packet having the smallest virtual finish time WF2Q : Scheduling Example Fairness of WF2Q • Cannot fall behind GPS by one packet, however, can not fall ahead GPS by one packet • This means Conclusion • WFQ provides fairness and end-to-end delay bound, but has a heavy implementation complexity • SCFQ, STFQ, WF2Q are easy to implement • Issues – Delay & bandwidth requirement is coupled Di i ri K 1 Pmax,i k 1 ri ,k K Pmax m1 rm