The general seing Traffic Cumulaive #bis: R(), R*() Insananeous speeds: r(), r*() analysis R(): arrivals sysem R*(): deparures Lecure 7 2 Lecure 7 3 Example: buffer R() R*() bi rae c R() = #bis ha arrived in [0, ] R*() = #bis served (sen) in [0,] #bis sored a ime (backlog): b() = R() R*() Work conserving sysem: b()>0 r()=c Arrival Curves Arrival curve α:, : R() - R( ) α(- ) Maximal offered raffic Moivaion: if arriving raffic is consrained by an arrival curve, hen he user can abuse sysem Lecure 7 4 Lecure 7 5
Example: (b,r)-consrained sreams Raes and Burss Given r 0 and s 0, we wrie R (b,r) iff for all imes y x, i holds: Assume R (b,r). Then: no buffer overflows buffer size b and drain rae r. Lecure 7 6 Given any r > 0, here exiss a (possibly infinie) number b, such ha if raffic is drained a rae r, and size of he buffer is s, hen he buffer never overflows. b r Lecure 7 7 Arrival Curves: subaddiiviy Service Curve Theorem: α can be replaced by a sub-addiive funcion Why: for any s < u < we have f is sub-addiive if for all x,y 0, f(x+y) f(x)+f(y) Oupu R*() for inpu R() ges service curve β iff for all exiss s such ha Minimal service guaranee Sar of busy period WLOG, service curve is super-addiive So α( 1 + 2 ) > α( 1 ) + α( 2 ) does no impose a new resricion Lecure 7 8 Lecure 7 9
Example 1: ideal adaper Line speed: C 1 Line speed: C 2 Example 2: rouer Fixed delay, hen fixed bandwidh R() R() Slope = C Slope = C2 1 superaddiiviy C r() C 1 C 2 Lecure 7 10 T In any inerval of lengh, a leas (-T) c served Lecure 7 11 Tigh Bounds on delay and backlog If flow has arrival curve α and node offers service curve β hen backlog(s) α(s) - β(s) delay h(α, β) backlog Is his he real delay? α h(α,β) β Lecure 7 12 Example: (b,r) sream and a rouer b h(α, β) T delay bound: b/c + T backlog bound: b + rt x r C Lecure 7 13
The (b,r) leaky bucke regulaor: packe release conrol Graphical Represenaion Packes Tokens added a rae r Never more Than b okens Packes One bye per oken r in () C () r ou C Slope = r Lecure 7 14 Lecure 7 15 Leaky Bucke Regulaor Inerpreaion 1: Traffic shaping. Force envelope by sopping packes unil sufficien okens. Wha are he (b,r) parameers of he inpu sream? Inerpreaion 2: Policing. Mark packes as conforming or no May discard non-conforming packes laer Burs delays do no accumulae D 1 D 2 α β 1 β 2 Recall: for a single rouer, b/c + T hence for wo rouers: D 1 +D 2 (b/c 1 + T 1 ) + (b /C 2 + T 2 ) D α β 1 β 2 Using he composiion heorem we ge D b/c 1 + (T 1 +T 2 ) < D 1 +D 2 Lecure 7 16 Lecure 7 25
Scheduling Scheduling a congesed link Desired Properies Performance guaranees. Offer differen Qualiy of Service (QoS) Fair resource sharing. Where? Wherever conenion for resources occurs. We will concenrae on he oupu of a nework layer swich. Lecure 7 26 Lecure 7 27 Prioriy Queuing Prioriy Queuing (2 levels) A prioriy level is assigned o each packe upon arrival Packes ransmied in ascending order of prioriy levels. level i serviced only if no packe of level < i. Preempive and non-preempive versions High-prioriy packes Low-prioriy packes Packe discard when full Packe discard when full When high-prioriy queue empy Transmission link Lecure 7 28 Lecure 7 29
Non-preempive, 2 prioriies scheduling High prioriy: May see only ails of low prioriy packes: Low prioriy: ges only lefovers Le s = beginning of he server busy period R* H (s) = R H (s) and R* L (s) = R L (s). Over he inerval (s, ], he oupu is C( s). Thus Discriminaion or Equaliy? Wih sric prioriy: Highes prioriy has he lowes delay, highes hroughpu, lowes loss Lower prioriy classes may be sarved by higher prioriy How o assign prioriies? Also: how o schedule wihin a class? Lecure 7 30 Lecure 7 31 Complee Equaliy: Round Robin Round Robin Round Robin: serve one packe from he nex nonempy class, in cyclic order Flow 1 Flow 2 Flow 3 Useful hardware : Jump o nex non-empy queue Transmission link Round robin Mode of work: Classify incoming raffic ino flows (sourcedesinaion pairs) Round-robin among flows Advanage: Proecion agains heavy users (full?) Problems: Ignores packe lenghs Inflexible allocaion of weighs Lecure 7 32 Lecure 7 33
Weighed Round-Robin Weighed round-robin Each flow i ges weigh w i Period of lengh W=Σw j Flow i can send w i packes in a period. Disadvanages Variable packe size. Fair only over ime scales longer han W. If w i /W is small, his may lead o long periods of unfairness. Defici Round Robin Choose a parameer quanum : # bis o serve from each connecion in urn. Each connecion has a credi couner, iniially zero. For each flow: If no packe o send, credi = 0 (o remain fair) Else: credi += quanum; if HOL packe size s new credi: send packe; credi -= s; Lecure 7 34 Lecure 7 35 Defici Round Robin DRR: performance Quanum size : 0 bye Second Round 2000 0 Firs Round 1500 500 300 1200 0 A B C Head of Queue 1s Round A s credi : 0 B s credi : 200 (served wice) C s credi : 0 2nd Round A s credi : 500 (served) B s credi : 0 C s credi : 800 (served) Lecure 7 36 Handles variable lengh packes Backlogged source share bandwidh equally Preferably, packe size < quanum Simple o implemen Similar o round robin Lecure 7 37
Fairness Fairness A 10 0.55 R 1 1.1 C A 10 R 1 1.1 D B 0.55 e.g. an hp flow wih a given (IP SA, IP DA, TCP SP, TCP DP) Wha is he fair allocaion: (0.55, 0.55) or (0.1, 1)? B C 0.2 Wha is he fair allocaion? Lecure 7 38 Lecure 7 39 Max-Min Fairness A common way o allocae flows Assume all users have equal righs (prioriy) o a resource: Each connecion ges no more han wha i wans. Excess is disribued evenly across connecions. Weighed Max-Min Fairness Suppose each connecion has a weigh: Some connecions are more imporan han ohers. A connecion of weigh w should send w bis for each bi a connecion of weigh 1 sends Toal Demand < Capaciy Toal Demand > capaciy Toal Demand < Capaciy Toal Demand > Capaciy 10 7 4.5 19 7 5 20 Lecure 7 40 W=1 W=1/2 W=2 W=1 W=1/2 W=2 Lecure 7 41
Weighed Max-Min Fairness: Algorihm Some flows share a link of rae C. Each flow f has weigh W(f) demand rae D(f) Goal: allocae rae R(f) o each flow f. Le W be he sum of all weighs, C he link rae. While W> 0do: 1. Le f be he flow minimizing D(f)/W(f). 2. R(f) := min( D(f), C W(f)/W ) // ha s i for f 3. Se W = W-W(f) // remaining weigh 4. C = C R(f) // lefover bandwidh 5. remove f from furher consideraion. Lecure 7 42 Flow f 1 f 2 f 3 f 4 Weighed Max-Min Fairness: Example run demand 6 8 4 3 weigh 1 2 4 1 D/W 6 4 1 3 C=16 Iniially: W 8, C 16 ieraion 1: R(f 3 ) 4 = min(4, 16 4/8) W 4, C 12 ieraion 2: R(f 4 ) 3 = min(3, 12 1/4) W 3, C 9 ieraion 3: R(f 2 ) 6 = min(8, 9 2/3) W 1, C 3 ieraion 3: R(f 1 ) 3 = min(3, 3 1/1) W 0, C 0 Lecure 7 43 Generalized Processor Sharing Each round Like muliple flows sharing he oupu line No flow has o wai for is urn. Is perfecly fair a all imes. GPS GPS - Anoher Example Packe A arrives a ime 0 Packe B arrives a ime 50 Boh packes are bis long. Oupu line rae is 1 b/s. BRR Can add weighs o each flow: ime A flow wih weigh 2 ges o send wo bis per round. Processor Sharing - send a small fracion of a bi Lecure 7 44 Lecure 7 45
GPS - Anoher Example GPS - A Weighed Example S A () S B () 50 50 75 25 150 50 200 arrival(a)=0, arrival(b)=50 Lengh=. Oupu speed=1 S A () S B () 50 60 50 40 70 150 80 200 arrival(a)=0, arrival(b)=50 Lengh=. Oupu speed=1 w(a)=1, w(b)=4 50 150 200 50 150 200 V() 50 75 150 V() 50 60 70 75 50 150 200 Lecure 7 46 50 150 200 Lecure 7 47 Fairness using GPS GPS: Measuring unfairness When here s no conenion: connecions ge wha hey ask for. When here s conenion: connecions share bandwidh proporionally o heir weighs: Denoe: BL() backlogged connecions a ime. Connecion i BL() ges rae Define: S A (f, ) = # bis ransmied for flow f in ime unis by policy A. Absolue fairness bound for policy A max(s GPS (f, ) - S A (f, )) Relaive fairness bound for policy A max(s A (f, ) - S A (f, )) for f,f backlogged in he ime unis Lecure 7 48 Lecure 7 49
GPS: Measuring unfairness If fixed packe size hen round robin gives: Relaive bound 1 pk Absolue bound < 1 pk Challenge: handle variable size packes. Fair Queuing Obviously: GPS canno be implemened Canno break packes o infiniely small pieces, and prefer no o cu even o small pieces (overhead). No real discipline can be as fair as GPS: when flow A is served we are unfair o all oher flows. Can ry o emulae GPS Goals: Keep emulaion close o GPS (absolue or relaive unfairness). Keep implemenaion cos low. Lecure 7 50 Lecure 7 51 Weighed Fair Queuing (WFQ) Realisic emulaion of GPS Basic idea: 1. Keep rack of wha GPS would have done 2. Serve packes in order of heir GPS finish ime WFQ - Example Noe ha WFQ (unlike simple round robin) handles variable packe sizes. Packes are sen in order of deparure in he corresponding GPS sysem WFQ GPS Lecure 7 52 Lecure 7 53
Delay Bound Delay Bound WFQ GPS WFQ GPS When WFQ and GPS finish packes a he same order, WFQ will never lag behind GPS. (And may someimes be ahead of GPS). When a packe arrives oo lae, i may have o wai for he curren packe o finish ransmission, hence L max /C delay. Error erm does no accumulae over ime. May accumulae over muliple nework hops. Lecure 7 54 Lecure 7 55 WFQ and GPS: single link GPS is never ahead of WFQ by more han one packe (in erms of ransmied bis up o ime ). Packes in WFQ are no delayed more han one packe lengh relaive o GPS: Bis sen: S GPS (f, ) - S WFQ (f, ) L max L max : lengh of longes packe in bis GPS and WFQ: Nework Parekh-Gallager heorem Suppose a given connecion is (σ,ρ) consrained, has maximal packe size L, and passes hrough K WFQ schedulers, such ha in he ih scheduler here is oal rae r(i) from which he connecion ges g(i). Le g be he minimum over all g(i), and suppose all packes are a mos L max bis long. Then Compleion ime: D WFQ (f, k) D GPS (f, k) L max / C C: link speed in bps Lecure 7 56 Lecure 7 57
P-G heorem: Inerpreaion Delay of las packe of a burs. Only in firs node GPS erm sore&forward penaly: only in nonfirs nodes WFQ lag behind GPS: each node GPS o WFQ correcion Lecure 7 58 Significance WFQ can provide end-o-end delay bounds So WFQ provides boh fairness and performance guaranees Bound holds regardless of cross raffic behavior Can be generalized for neworks where schedulers are varians of WFQ, and he link service rae changes over ime Lecure 7 59 Fine Poins To ge a delay bound, need o pick g he lower he delay bound, he larger g needs o be large g means exclusion of more compeiors from link Sources mus be leaky-bucke regulaed bu choosing leaky-bucke parameers is problemaic WFQ couples delay and bandwidh allocaions low delay requires allocaing more bandwidh wases bandwidh for low-bandwidh low-delay sources Wors Case WFQ (WF 2 Q) We ve jus said ha WFQ approximaes GPS o wihin a difference of one packe. Tha was a lie! The bound is one way: WFQ is never lagging by oo much, S WFQ (f, k) - S GPS (f, k) L max bu here s no lower bound In fac WFQ migh be well ahead of GPS! Lecure 7 60 Lecure 7 67
WF 2 Q - Example S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 0 1 10 11h packe R1=0.5 R2=R3= =R11=0.05 Packe lenghs: 1 sec GPS Service Order 11h packe S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 0 10 20 Lecure 7 68 Lecure 7 69 WFQ Service Order 11h packe S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 0 10 20 WF 2 Q Service Order 11h packe S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 0 10 20 Lecure 7 70 Lecure 7 71
WF 2 Q Idea WFQ: scheduler selecs nex packe wih minimal finish number from all available packes. Wors-case fair weighed fair queuing (WF 2 Q): scheduler considers only packes ha have sared in he emulaed GPS sysem. Ge closer emulaion of GPS: add lower bound on he ime difference wih GPS Implemenaion: Rae Conrolled Scheduling Regulaor holds packes unil hey are eligible for ransmission. Scheduler decides which eligible packe should be ransmied nex. Swich Oupu Module Queue 1 Queue 2 Queue 3 Regulaor Regulaor Regulaor Queue 1 Queue 2 Queue 3 Scheduler Lecure 7 72 Queue 4 Regulaor Queue 4 Lecure 7 73 WF 2 Q Properies Reain upper bound of WFQ Add lower bound (bes possible in general) WF 2 Q Properies (con.) Discipline is work-conserving: Rae conroller + GPS scheduler is he same as GPS alone. Replace GPS wih WFQ (boh work conserving) o ge WF 2 Q. Lower bound WF 2 Q sars sending packe no earlier han GPS. GPS usually akes more ime o ransmi he packe (depending on allocaed and available bandwidh). r g i L g L r i i, max i,max WF 2 Q GPS Lecure 7 74 Lecure 7 75