Onln Load Balancng and Corrlatd Randomnss Sharayu Moharr, Sujay Sanghav Wrlss Ntworng and Communcatons Group (WNCG) Dpartmnt of Elctrcal & Computr Engnrng Th Unvrsty of Txas at Austn Austn, TX 787, USA Emal: sharayu.moharr@gmal.com, sanghav@mal.utxas.du Abstract Ths papr loos at onln load balancng, n a sttng whr ach job can only b srvd by a subst of th srvrs. Th substs ar rvald only on arrval, and can b arbtrary. Th cost of an allocaton s th sum of cost for ach srvr, whch n turn s a convx ncrasng functon of th numbr of jobs allocatd to t. Thr ar no dparturs. A natural class of polcs ar thos whch always put a job nto on of ts srvrs that has th last load at th tm of arrval. Howvr, t turns out that not all (randomzd) ways of brang ts s th sam. W propos an algorthm - TIERED RANKING - that bras ts n a vry partcular, corrlatd random way; t s nsprd by th onln matchng wor of Karp, Vazran and Vazran. W show that t s optmal (n trms of compttv rato) n th abov class, for all convx cost functons that grow slowr than x (whch ncluds all l p norms). W also prov t strctly outprforms any dtrmnstc algorthm; smulatons show that t also vsbly outprforms th nav randomzd algorthm, that bras ts among lowstloadd srvrs unformly at random. I. INTRODUCTION W consdr th onln problm of allocatng jobs to a group of srvrs. W study th cas whr ach job can only b srvd by a subst of th srvrs. Th jobs arrv n a squnc and thr ar no dparturs. An xampl of such a systm s a data cntr whr thr s a ban of srvrs, and svral pcs of contnt. Each pc of contnt has bn rplcatd and put on a fw of th srvrs. As jobs com n and ma dmands for a partcular contnt pc, thy nd to b allocatd to on of th srvrs havng that contnt. W dfn th cost of an allocaton as th sum of th cost born by th ndvdual srvrs. W focus on th cass whr th cost functon for ach srvr s a convx functon of th numbr of jobs allocatd to that srvr. Many such cost functons hav bn studd n ltratur, for xampl, th l p norm for p < of th load vctor was studd n [4], th l norm was studd n [] and s popularly nown as th ma-span problm. Th man challng s to dsgn an onln algorthm that s unvrsal n th sns that t provds th optmal prformanc for any convx cost functon. In ths wor, th prformanc of an onln algorthm s compard wth th prformanc of th optmal offln algorthm whch nows th squnc of job arrvals n advanc. W charactrz th prformanc of an onln algorthm by ts compttv rato whch s th rato of th cost of th onln algorthm to th cost of th optmal offln algorthm, maxmzd ovr all nput squncs. W ar ntrstd n a class of algorthms whch w call th Load th Lowst Quu (LLQ) algorthms. Th LLQ class of algorthms nclud all dtrmnstc and randomzd algorthms whr an ncomng job s always allocatd to on of th currntly lowst loadd srvrs that can srv t. A. Contrbutons Our man contrbuton s th TIERED RANKING algorthm and ts prformanc analyss. Th TIERED RANKING algorthm s an LLQ algorthm, but t bras ts btwn svral lowst-loadd srvrs n a vry partcular corrlatd-random way: frst a random prmutaton s chosn for vry load-lvl, thn, vry t at a partcular lvl s bron accordng to that prmutaton. W show An uppr bound (.. achvabl) on th compttv rato of TIERED RANKING (Thorm ). A lowr (.. outr) bound on th compttv rato of any randomzd LLQ algorthm for convx cost functons that grow slowr than x. Ths shows th optmalty of TIERED RANKING n ths class (Thorm ). A lowr bound for all dtrmnstc algorthms, showng thm to b strctly wors than randomzd algorthms (Thorm 3). W us ths rsults to prov th optmalty of th TIERED RANKING algorthm for load balancng n th
l p norm for any p < whch has bn of ntrst n [4], [3]. Our rsults mprov th nown compttv rato bounds for onln load balancng n th l p norm [4] and w compar th rsults n Scton VII. Fnally w show va smulatons that TIERED RANKING vsbly outprforms th smpl random LLQ algorthm. B. Rlatd Wor Our t-brang rul s nsprd by th wor on onln matchng. W now rvw ths and prvous wor on onln allocaton. ) Onln Matchng: Th problm of onln matchng n bpartt graphs has bn studd n [5] by Karp, Vazran and Vazran. Ths wor provds tght bounds on th compttv rato. An onln algorthm calld RANKING was proposd n [5] and t was shown that th compttv rato of RANKING s gratr than. It was also shown that th compttv rato for any onln algorthm s lss than + o(). Varous xtnsons to wghtd graphs, stochastc arrvals tc. can b found n th rfrncs of []. ) Onln Load Balancng: [] loos at th maspan problm,.., mnmzng th largst load among srvrs. Th randomzd algorthm proposd n [] s calld AR. Th algorthm was shown to b optmal n th class of all randomzd algorthms for ths objctv functon. [3] loos at th l p norm of th load vctor for th GREEDY algorthm (load th lowst loadd srvr, bras ts unformly at random). For th Eucldan norm, thy provd that compttv rato s at most.4. An mprovmnt on th rsults of [3] was mad n [4] whch lood at th problm of schdulng ovr unrlatd machns. Th trm unrlatd machns mans that ach job tas a dffrnt srvc tm on ach of th machns wth no corrlaton btwn jobs or machns. Ths s th frst analyss of randomzd algorthms for l p norms for p =,3.., 37. Th proposd randomzd algorthm s calld BALANCE. II. SETTING Thr s a st U of srvrs and jobs arrv squntally. Each job can b srvd by any on of th srvrs n a subst of srvrs. Th apparanc of a job s quvalnt to th dsclosur of th st of srvrs whch can srv t. W consdr a convx cost functon f such that th cost of allocatng n u jobs to srvr u s f(n u ). W assum that f(0) = 0. Th goal s to dsgn an onln allocaton algorthm whch mnmzs th total cost C whr C = u U f(n u ). Th onln algorthm must assgn ach job to a srvr whn t arrvs. W consdr th advrsaral sttng whr w assum th prsnc of an oblvous advrsary,.., on who nows th onln allocaton algorthm, but s unawar of th rsults of th con flps durng ts xcuton. W rstrct ourslvs to arrval squncs such that t s possbl for th optmal algorthm to assgn xactly on job to ach srvr. Lt th st of such arrval squncs b A. Thus n th st A, th numbr of jobs s qual to th numbr of srvrs = n. Ths rstrcton s rqurd for th proofs n ths papr, but, w drop ths rstrcton n th smulatons. Th prformanc of th algorthm s masurd n trms of th compttv rato ρ, whr ρ(algorthm) = max A A ( ) Calgorthm (A). C optmal (A) Not that C optmal (A) = nf() by our assumpton on A. C algorthm (A) s th xpctd cost of th onln algorthm on A. By dfnton, ths rato s always >. Th goal s to dsgn an algorthm whch mnmzs ths quantty. III. OUR ALGORITHM Algorthm TIERED RANKING : Choos a unformly random squnc of prmutatons π, 0. : Intalz Load(j)=0 for all srvrs j. 3: for arrvng job p wth srvr st S p do 4: From ts st S p, fnd th subst L p S p of th lowst loadd srvrs. L p = {j S p Load(j) Load(), S p } Lt l b th load n th srvrs n L p. 5: Allocat p to j L p such that π l (j ) π l (j) for all j L p. 6: Incrmnt Load(j ) Load(j ) + 7: nd for Rmar: Ths algorthm was studd n [] whr ts prformanc was studd for th maspan problm. Our proofs us th followng quvalnt vsualzaton of th allocaton procss. Construct a squnc of cops of th srvrs n st U and nam thm U, U,... W wll rfr to all srvrs n U as srvrs at lvl. Lt π nduc prorts on U. In ths largr st of srvrs, w allocat at most job to ach srvr. Whn a job arrvs, fnd th smallst such that th job can b srvd by a srvr
Jobs wth rsp. srvr sts {,} {} a b {,3} c {} Fgur. d Srvrs 3 3 3 Lvl Lvl Lvl 3 TIERED RANKING n U. Assgn th job to that avalabl nod n U whch can srv ths job and has th hghst prorty accordng to π. An llustratv xampl wth 3 srvrs can b sn n Fgur. Consdr an arrval squnc A A on whch algorthm TIERED RANKING s xcutd. Lt P b th st of jobs allottd to srvrs n U durng ths xcuton. Consdr now a nw arrval procss A = A \ P obtand from A by rmovng th jobs n P. Now th algorthm TIERED RANKING s xcutd on A wth prmutatons π = π +, and wth th sam ordr of job arrvals as n A. Th allocaton that TIERED RANKING producs n U s dntcal to th allocaton n U of th orgnal xcuton []. Lmma. Lt th total numbr of job arrvals n A b n and lt N b th numbr of jobs that do not gt allocatd to srvrs n U,... U by th TIERED RANKING algorthm. Thn, ( ) E[N ] n. Proof: W prov th proprty by nducton. Th statmnt clarly holds for =. Assumng that th statmnt holds for =, w hav that, ( ) E[N ] n. Lt M dnot th jobs allocatd to srvrs at lvl by th TIERED RANKING algorthm. Ths allocaton s quvalnt to a allocaton by th TIERED RANKING algorthm wth π 0 = π wth th arrval procss bng A\M...\M. Usng Thorm n [5], w hav that, ( E[M ] ) E[N ]. Thrfor, E[N + ] = E[N ] E[M ] ( ) n E[M ] ( ) ( ) ( n n ) ( ) = n, whch complts th proof by nducton. By Thorms 4. and 4.3 n [], w hav that for th l norm.. th maspan, th TIERED RANKING algorthm has an xpctd compttv rato whch s at most log n + whch s optmal n th class of all randomzd onln algorthms. IV. UPPER BOUND FOR TIERED RANKING FOR CONVEX COST FUNCTIONS Thorm. Lt U = n and lt A A b an arrval squnc of n jobs as dfnd n Scton II. Dfn = f( + ) f() + f( ). Th xpctd compttv rato of Algorthm TIERED RANKING for th cost functon f s at most n ( ) + f(). = Proof: For ths proof, rcall th vsualzaton outlnd n Scton III. All srvrs n U ar assgnd a cost of C (f) unts whr C (f) = f() f( ). () Not that wth ths dfnton of C (f), f only th frst cops of a nod u U ar allocatd a job, thr combnd contrbuton to th cost of th algorthm s f(). Rcall from th dfnton of N that th numbr of jobs allocatd to a srvr n U s N N +. Hnc th total cost C of an allocaton s n C = (N N + )C (f) = = nf() + n = N (C (f) + C(f) ), 3
whch can b rwrttn as n C = nf() + N. = If f s a convx functon, thn, = f( + ) f() + f( ) 0. Usng th lnarty of xpctaton, Lmma and th fact that 0 for all, E[C] = nf() + n = n nf() + n = E[N ] ( ). Snc th cost of th offln optmal allocaton s nf(), th rsult follows. V. LOWER BOUND FOR LLQ ALGORITHMS W now provd xampl arrval squncs whch provd lowr bounds (.. outr bounds) on th LLQ algorthms. A. Dtrmnstc LLQ Algorthms Lmma. Lt U = n =. Th compttv rato for any dtrmnstc algorthm for th cost functon f s at last f( + ) f() + = f() f() +. Proof: For th purpos of llustraton, w dvd th job arrvals nto phass. In th frst phas, jobs ar ntroducd, ach on can b srvd by all th srvrs. Th srvrs that ar assgnd jobs by th algorthm n ths phas ar rtand for th nxt phas. In th nxt phas, jobs ar ntroducd, ach on of thm can b srvd by all th rtand srvrs. Th sam procss contnus for th nxt 3 phass. In th last phas, th advrsary prsnts on job that can b srvd only by both th rmanng srvrs and thn prsnts an addtonal job that can b srvd only by th srvr that was assgnd th frst job n ths phas. Th cost of th allocaton don by th dtrmnstc algorthm s ( ) f() + + +. = Th optmal allocaton has cost f(). Thrfor, th compttv rato s ( ) + f() + S(f) + f(). () = So, th uppr bound for th TIERED RANKING s lowr than th lowr bound for any dtrmnstc LLQ algorthm. B. Randomzd LLQ Algorthms Consdr th followng arrval pattrn. Lt T b th n n complt uppr-trangular matrx. Lt th columns of ths matrx rprsnt jobs and th rows rprsnt srvrs. W assum that jobs.. columns arrv from rght to lft. Th ntry T (, j) = f job j can b srvd by srvr and 0 othrws. In ths scton, w consdr th st of all Randomzd LLQ algorthms. For xampl for n = 8, th arrval matrx T s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Rmar: W now rmar on a partcular rcursv proprty of th abov arrval squnc, that w us n our bounds. For any sampl path of a randomzd allocaton algorthm, consdr th sub-matrx formd by all jobs allocatd at lvl or abov. In partcular, consdr th sub-matrx formd as follows: fx any numbr, and rmov all jobs (.. columns) that wr allocatd to srvrs that alrady had at most jobs (ncludng that partcular job). Thn, rmov srvrs whch cannot b usd by any of th rmanng jobs (.. rmov rows whch, aftr th column rmoval, hav no non-zro lmnt). Thn, ths sub-matrx s uppr trangular. Ths s asy to s: lt j b th job (.. column) that was th frst to fac all srvrs wth loads or hghr at arrval. Snc vry subsqunt job can only b srvd by a subst of th srvrs that j can us, ths mans all of thm ar rtand n th sub-matrx abov. Also, vry srvr that j could not us wll b rmovd as wll n th abov constructon. Thus th rmanng matrx s a squar toplft cornr sub matrx of th abov matrx, and hnc s also uppr trangular. 4
Lmma 3. For th arrval squnc dscrbd abov for n > c whr c s an absolut constant and for vry lvl l, th numbr N l of jobs placd at lvls hghr than l satsfs: ( ) l l E[N l ] n. =0 Proof: W prov th proprty by nducton. For th uppr trangular arrval squnc, for n > c whr c s an absolut constant, by Lmma 6 n [5], w hav that ( ) /n E[N ] n n. Thrfor, th statmnt holds for l =. Assumng that th statmnt holds for l =, w hav that, ( ) E[N ] n. =0 Lt M dnot th allocaton obtand at lvl by th randomzd LLQ algorthm. W now that th nput matrx at lvl s uppr trangular. For an uppr trangular matrx, by Lmma 6 n [5], w hav that, E[M ] ( ) N N + ( ) N +. Thrfor, E[N + ] = E[N ] E[M ] ( E[N ] ) E[N ] = E[N ] ( ( n ( ) = n ) =0. Ths complts th proof by nducton. Thorm. Lt C (f) f s such that n = =0 ) b as dfnd n (). If th functon f() = o(n), thn th xpctd compttv rato of any Randomzd LLQ Algorthm for th cost functon f as n s at last ( ) + f(). = Proof: W show ths by valuatng any Randomzd LLQ algorthm on th uppr trangular arrval squnc dfnd abov. Lt C b th total cost of an allocaton. W hav that, n C = n + N. = By Lmma 3, w now that: ( ) l l E[N l ] n. =0 Snc 0 for all, w gt that n ( ( ) ) E[C] nf() + n j = j=0 n ( ) n = nf() + n = = j=0 n ( ) n n = nf() + n j Not that, n lm n =j = =j j=0 = C (f) j. j S(f) =j. By th assumpton on th arrval procss, w hav that cost of th optmal algorthm s nf(). Addtonally, f w hav that, thn, w hav that, n =0 Thrfor, lm n n =0 f() o(n), C(f) = n =0 C nf() + = f() o(n). ( ) f(), (3) whch gvs us th dsrd rsult. From () and (3), w can s that as n, th randomzd algorthms hav a smallr lowr bound for th xpctd compttv rato than th dtrmnstc algorthms. Thrfor, n th class 5
of all onln LLQ algorthms, th compttv rato s at last ( ) + f(). = VI. LOWER BOUND FOR DETERMINISTIC ALGORITHMS Thorm 3. Lt U = n =. Th compttv rato for any dtrmnstc algorthm for th functon f as s ( ) + f(). = Proof: For th purpos of llustraton, w dvd th n job arrvals nto phass. In th frst phas, th advrsary forms pars. For ach par, th advrsary prsnts on job that can b srvd only by both srvs n that par. Th srvrs that ar assgnd jobs by th algorthm n ths phas ar rtand for th nxt phas. Th sam procss contnus for th nxt phass. In th last phas, th advrsary prsnts on job that can b srvd only by both th rmanng srvrs and thn prsnts an addtonal job that can b srvd only by th srvr that was assgnd th frst job n ths phas. Th cost of ths allocaton s + + = ( ) + f(). As, th compttv rato tnds to ( ) + f(). = VII. l p NORMS By Thorms and, th TIERED RANKING algorthm s th optmal LLQ algorthm all l p norms for p >. Th cas p = s of spcal ntrst as th squar of th l norm of th load vctor can b ntrprtd as th avrag dlay of th jobs n th systm assumng that th srvc dscpln s procssor sharng and ach job nds a srvc of unt. Corollary 4. Th xpctd compttv rato of Algorthm TIERED RANKING for avrag dlay s at most +. Proof: For p =, consdr th cost functon f() =. Thrfor, S () = ( + ) + ( ) =. Th cost C of an allotmnt for f() = s C = n + n N. = Usng th lnarty of xpctaton and Lmma, E[C] = n + n E[N ] = ) ( n + n = ( ) = n + n ( ) + = n. Snc th offln optmal has an l norm of n unts, th xpctd compttv rato for th l norm s lss than +. Th compttv rato for th avrag dlay s lss than + =.6. Tabl I UPPER BOUNDS FOR EXPECTED COMPETITIVE RATIOS p TIERED RANKING BALANCE [7] (Uppr Bound) (Uppr Bound).47.3 3.86 3.66 4.37 4.88 5.64 6. 6 3.03 7.33 Tabl I lsts th compttv ratos for two algorthms for a fw valus of p. Th algorthm BALANCE ntroducd n [4] was analyzd for a mor gnral sttng, whr th wght of ach job on vry srvr that can srv t was ndpndnt of ts wght on any othr srvr. Th bounds lstd for th BALANCE algorthm ar for ths mor gnral sttng. In Fgur w can s that as n, TIERED RANKING outprforms any dtrmnstc algorthm for th l p norm. 6
Thrfor, x = and y y = w.p. y + and 0 othrws. W thrfor hav that dy dx = y y +. Solvng for y wth ntal condtons x = n, y = n/, w gt that: x = y + n + log y n. For x = n/, w hav that: Fgur. Compttv Ratos for th l p Norm VIII. SIMULATIONS: RANDOM LLQ VS TIERED RANKING In ths scton, w compar th prformanc of TIERED RANKING wth anothr randomzd LLQ algorthm for th cost functon bng th squar of th l norm. W call th nw algorthm RANDOM LLQ. Whn a job coms n, th algorthm RANDOM LLQ allots t to any on of th lowst loadd srvrs that can srv t, and bras ts unformly at random, and ndpndnt of past chocs. Consdr an arrval matrx such that T (, ) = for n, T (, j) = f j n/, n/, T (, j) = f j n/4, n/4 and T (, j) = 0 othrws. Rcall that columns rprsnt jobs and rows rprsnt srvrs. Th columns arrv from rght to lft. For xampl, for n = 8, ths matrx s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 W now analys th prformanc of th RANDOM LLQ algorthm for ths matrx. W frst focus on th frst n/ srvrs. Lt x(t) and y(t) b random varabls dnotng th numbr of jobs rmanng and th numbr of srvrs among th frst n/ srvrs whch hav not bn allocatd a pact by tm t. Lt x = x(t) x(t + ), y = y(t) y(t + ). Consdr th functon y + log y n f(y) = y y n. = 0. (4) Th soluton to Equaton 4 s th sam as th soluton to f(y) = 0. W hav that f(0) =, f s a strctly dcrasng functon and f(log(n)) = ( log(n))/n < 0 for n larg nough. Thrfor, y, th soluton to Equaton 4 s < log(n). Thrfor, M n/ + o(n). Carryng out th sam analyss for th nxt n/4 pact arrvals, w hav that M n/4 + o(n) and M 3 = n (M + M ). Thrfor th total cost C of allotmnt s C = M + 3M + 5M 3 = M + 3M 3 + 5(n (M + M )) = 5n 4M M.5n + o(n). Thrfor th compttv rato for RANDOM LLQ s.5 whch s gratr than th uppr bound for th compttv rato of TIERED RANKING for th squar of th l norm (.6). In Fgur 3 w s th compttv ratos for RAN- DOM and TIERED RANKING for th matrx T for dffrnt valus of n. It can b sn that TIERED RANKING outprforms RANDOM LLQ for ths nput squnc. IX. CONCLUSIONS AND DISCUSSION W consdrd a natural modl for onln allocaton of jobs to srvrs wth a constrant on whch srv can srv ach job. Our algorthm, and analyss stablshd th (somwhat countr-ntutv) mportanc of corrlatd randomnss n ths sttng. Svral xtnsons naturally suggst thmslvs: ) loong at systms wth dparturs. ) dffrnt cost functons for dffrnt srvrs. 3) stochastc vs advrsaral arrvals. 4) mor gnral arrval squncs. 7
Fgur 3. Compttv Ratos for f() = for T REFERENCES [] U. Vazran V. Vazran A. Mhta, A. Sabr. Adwords and gnralzd on-ln matchng. Procdngs of FOCS, 005. [] Y. Azar, J. Naor, and R. Rom. Th compttvnss of on-ln assgnmnts. In Procdngs of th thrd annual ACM-SIAM symposum on Dscrt algorthms, Orlando, FL, Sptmbr 99. [3] E. F. Grov M.-Y. Kao P. Krshnan B. Awrbuch, Y. Azar and J. S. Vttr. Load balancng n th l p norm. [4] I. Caraganns. Bttr bounds for onln load balancng on unrlatd machns. In Procdngs of th nntnth annual ACM-SIAM symposum on Dscrt algorthms, San Francsco, Calforna, 008. [5] R.M. Karp, U.V. Vazran, and V.V. Vazran. An optmal algorthm for on-ln bpartt matchng. In Procdngs of th twnty-scond annual ACM symposum on Thory of computng, Baltmor, Maryland, May 990. 8