i: Incrementl Cost bsed Scheduling under Piecewise Liner SLAs Yun Chi NEC Lbortories Americ 18 N. Wolfe Rd., SW3 35 Cupertino, CA 9514, USA ychi@sv.nec lbs.com Hyun Jin Moon NEC Lbortories Americ 18 N. Wolfe Rd., SW3 35 Cupertino, CA 9514, USA hjmoon@sv.nec lbs.com Hkn Hcıgümüş NEC Lbortories Americ 18 N. Wolfe Rd., SW3 35 Cupertino, CA 9514, USA hkn@sv.nec lbs.com ABSTRACT In cloud computing environment, it is beneficil for the cloud service provider to offer differentited services mong different customers, who often hve different profiles. Therefore, -wre scheduling of queries is importnt. A prcticl -wre scheduling lgorithm must be ble to hndle the highly demnding query volumes in the scheduling queues to mke online scheduling decisions very quickly. We develop such highly efficient -wre query scheduling lgorithm, clled i. i tkes the query s derived from the service level greements (SLAs) between the service provider nd its customers into ccount to mke wre scheduling decisions. i is n incrementl vrition of n existing scheduling lgorithm,. Although exhibits n exceptionlly good performnce, it hs prohibitive complexity. Our min contributions re (1) to observe how behves under piecewise liner SLAs, which re very common in cloud computing systems, nd (2) to efficiently leverge these observtions nd to reduce the online complexity from O(N) for the originl version to O(log 2 N) for i. 1. INTRODUCTION In cloud computing environment, service providers offer vst IT resources to lrge sets of customers with diverse service requirements. By doing so, the service providers leverge the customer volume to chieve economies of scle. A service provider usully hs contrcts with its customers in the form of service level greements (SLAs), where the SLAs cn be bout mny spects of cloud computing service such s vilbility, security,, etc. An SLA indictes the level of service greed upon s well s the ssocited if the service provider fils to deliver the level of service. In this work, we focus on this defined by the SLAs. Obviously, optimizing the while serving lrge number of customers is vitl for the cloud service providers. Such n optimiztion hs to tke mny spects of cloud computing system into considertion, such s c- Permission to mke digitl or hrd copies of ll or prt of this work for personl or clssroom use is grnted without fee provided tht copies re not mde or distributed for profit or commercil dvntge nd tht copies ber this notice nd the full cittion on the first pge. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission nd/or fee. Articles from this volume were invited to present their results t The 37th Interntionl Conference on Very Lrge Dt Bses, August 29th September 3rd 211, Settle, Wshington. Proceedings of the VLDB Endowment, Vol. 4, No. 9 Copyright 211 VLDB Endowment 215 897/11/6... $ 1.. pcity plnning, disptching, nd scheduling. Therefore, single ll-inclusive solution is very difficult to obtin (see Appendix A for more discussions). Insted, in this pper we focus on locl optimiztion problem, nmely to schedule queries from diverse customers in -wre wy in order to minimize the SLA to the service provider. The problem of -wre scheduling hs been studied in the pst in the res of computer networks [12] nd rel dtbses [7]. However, it is somewht discourging to note tht the developed lgorithms hve not been widely deployed in rel pplictions, minly due to their high complexity. Such sitution seems to be chnging with the dvnce of the cloud computing. This is evident from the recent new interests in -wre scheduling lgorithms in the dtbse re [1, 4, 5]. We believe tht the cloud computing environment offers two resons for such chnge. Chnge in resource usge for scheduling: In order to mke scheduling decisions, we hve to use system resources (e.g., CPU cycles nd memory). In computer networks, for exmple, the rtio between the resources used by scheduling nd those used by processing network pcket hs to be very low, becuse of the limited resource cpcity t network router. This is min reson why simple policies such s firstcome-first-serve (FCFS), shortest-job-first (SJF), nd erliest-dedline-first (EDF) were preferred. In comprison, this rtio of resource usges is very different in the cloud computing environment. In the cloud computing environment, higher resource usge for scheduling is cceptble, s long s doing so is justified by the reduction in the query execution. Avilbility of functions: In trditionl computer networks nd rel- dtbses, there is lck of consensus on wht the most resonble function should be. In the cloud computing environment, such functions re usully vilble from the contrcts between the service providers nd their customers, in the form of service level greements (SLAs). In ddition, the SLAs used by cloud service providers re usully piecewise liner functions becuse they cn be defined by the cluses in business contrcts. Such piecewise liner SLAs, s we will show, mke mny -wre scheduling computtions more trctble. Bsed on the bove motivtions, we investigte wre scheduling lgorithm,, tht hs been proposed by Peh nd Tobgi [1, 12]. The min reson for us to choose 563
is its exceptionlly good performnce, which often pproches the lower bound of theoreticlly optiml totl [1]. Our own experiments, s will be shown lter, verified this clim, showing tht outperforms severl recently proposed -wre scheduling lgorithms in the dtbse systems [4] nd supercomputing [8] communities. However, suffers from one wek point its complexity for mking ech scheduling decision is O(N), where N is the number of queries to be scheduled. Such liner complexity is prohibitive in cloud computing system, where there cn be very lrge number of queries to be scheduled nd where the online decisions hve to be mde extremely quickly. We will discuss in detil in the next section. Here we only point out tht in, the priorities of the queries re dynmiclly chnging over. On one hnd, such dynmiclly chnging priorities cpture the chnge of urgency of queries over (e.g., s query pproching its dedline) thereby mking superior to lgorithms tht simply ssign sttic priority scores to the queries. On the other hnd, becuse the query priorities hve to be re-computed ech scheduling decision is mde, it seems tht the liner complexity O(N) is necessry price tht we hve to py. However, in this pper, we demonstrte tht the liner complexity of cn be voided, under piecewise liner functions (SLAs). The min contributions of this pper re two-fold. First, we observe tht in, lthough the priority scores of the queries chnge continuously over, the reltive order mong the priority scores only chnges s discrete events. In other words, the reltive order chnges over s series of discrete snpshots. Our second contribution is to develop n efficient scheduling lgorithm, i, to exploit the bove observtion. In i, the bove snpshots re incrementlly mintined, where from these snpshots, the query with the top priority cn be obtined very quickly. Our i lgorithm mkes exctly the sme scheduling decisions s. But compred with the O(N) complexity of, i chieves complexity of O(logN) for mny piecewise liner SLAs, nd O(log 2 N) for ll piecewise liner SLAs, by using techniques borrowed from the field of computtionl geometry. i is lso used s the scheduler in our comprehensive dt mngement pltform in the cloud, CloudDB [6]. 2. BACKGROUND AND RELATED WORK In this section, we provide bckground informtion. We first discuss SLAs, especilly vrious piecewise liner SLAs. Then we survey recent work on SLA-bsed scheduling lgorithms. Finlly, we introduce the lgorithm in detil. 2.1 Service Level Agreements (SLAs) A service level greement (SLA) is contrct between service provider nd its customers. An SLA indictes the level of service greed upon s well s the ssocited if the service provider fils to deliver the level of service. SLAs cnbeboutmnyspects ofcloudcomputingservicesuch s vilbility, security,, etc. In this pper, we focus on SLAs bout query. Tht is, n SLA is function f(t), where t is the of query nd f(t) is the corresponding if the is t. Fig. 1 shows severl exmples of SLAs used in previous work (e.g., [1, 4, 8]). Fig. 1 shows step-shped function, where the to the service provider is c 1 if the s1 (c) s1 t2 c2 Figure 1: Exmples of SLAs used in previous work. query is lter thn its dedline t 1. Fig. 1 shows function tht increses proportionlly to the trdiness, fter dedline t 1 is missed. In Fig. 1(c), the hs bound c 2, which indictes the mximum query cn introduce. It is worth noting tht lthough the SLAs shown in Fig. 1 represent mpping between system-level metrics(e.g., query ) nd s, the system-level performnce cn be drmticlly different from the performnce. For exmple, ssume service provider offers services to two customers, gold customer nd silver customer, by using shred dtbse server. Becuse the customers hve different SLAs, simply from the distribution of query for ll the queries, we re not ble to tell how good the performnce is in terms of. This is becuse the ltter depends on other fctors such s the shpe of the SLAs from the gold nd silver customers, the worklod rtios between the two customers, how the scheduling priority is determined, nd so on. Insted of functions, SLAs in some previous work re in the form of profit functions. We show in Appendix B.1 tht these two re equivlent. In ddition, in this pper we use per-query SLAs insted of per-customer or quntile SLAs, becuse we believe the former hve more flexibility. For exmple, under per-query SLAs, queries from the sme customer my hve different SLAs, depending on the expected execution nd resource consumption of the query, or depending on the budget quot tht the customer hs used so fr. In ddition, there exists techniques (e.g., [3]) tht directly mp per-query SLAs to quntile SLAs. 2.2 Piecewise Liner SLAs We focus on piecewise liner SLAs, s they exhibit very good model for cpturing service contrcts. By piecewise liner SLA, we men tht the function f(t) cn be divided into finite segments long the line nd in ech segment, f(t) is function liner in t. We next provide severl representtive piecewise liner SLAs nd show tht these SLAs re ble to cpture vrious rich semntics. Fig. 2 shows severl exmples of piecewise liner SLAs. In the figure, the x-xis represents query (for esy illustrtion, we ssume the query rrives to the system t ); the y-xis represents the corresponding to different t. We discuss these cses in detil. Fig. 2 describes n SLA with linerly incresing versus the. Tht is, the is proportionl to the. Such n SLA reflects trget of weighted men. A moment of thought will revel tht under such SLAs, minimizing the totl mong ll queries is equivlent to minimizing the weighted of ll queries, where the weight for ech query is proportionl to the slope of its linerly incresing SLA. Fig. 2 describes n SLA in the form of step function, where the is c if the is less thn t 1 nd c 1 otherwise. As specil cse, when c nd c 1 1 for ll queries, the verge under such n SLA is the sme 564
c c s (d) s1 c c s (e) c2 c c2 c s s1 (c) t2 (f) s2 t2 Figure 2: Representtive piecewise liner SLAs. s the frction of queries tht miss their (sole) dedlines. It is worth noting tht in this cse, nd in ll other cses in the figure, the prmeters such s c, c 1, nd t 1 cn be different for ech individul query. Tht is, ech query cn nme its own dedline nd corresponding for missing tht dedline. Fig. 2(c) describes stircse-shped SLA. The is c if the is less thn t 1, c 1 if the is between t 1 nd t 2, nd so on. Finlly, the becomes fixed vlue (c 2 in this exmple) fter the lst dedline (t 2 in this exmple). Such n SLA cn be used to cpture multiple semntics simultneously. For exmple, when checking out shopping crt t n online e-commerce Web site, less thn t 1 my result in good user experience wheres longer thn t 2 my reflect certin uncceptble performnce (e.g., t 2 cn be the out threshold of the user s browser, fter which the query result becomes invlid). Fig. 2(d) describes the mixture of step function nd liner function. Tht is, the remins constnt up to t 1 nd then grows linerly fterwrd. This SLA llows grce period, up to t 1, fter which the grows linerly over. This exmple lso illustrtes tht in generl, SLAs my contin jumps (t t 1 in this exmple) in the functions. Fig. 2(e) describes nother wy of mixing the step nd liner functions. The initilly grows linerly, but fter t 1, it becomes constnt. This SLA cptures, for exmple, the concept of proportionl with -out. Tht is, fter t 1, the dmge hs been done nd so the hs reched its mximl penlty vlue. Fig. 2(f) describes piecewise liner SLA in the most generl form. Tht is, the slope t ech segment cn be different nd there cn be jumps between consecutive segments in the SLA. Other thn cpturing vrious rich semntics, piecewise liner SLAs lso mke mny computtions in -wre scheduling more trctble, which is key to our work. 2.3 Relted Work Scheduling is mture problem nd hs long been extensively studied in vrious res such s computer networks, dtbse systems, nd Web services. There exist mny different scheduling policies nd there is vst mount of theoreticl results nd prcticl nlysis on vrious policies (e.g., see [9]). However, in most existing work on scheduling, the performnce metrics re low-level metrics (e.g., verge query or stretch [5]). Insted, in this subsection, we minly survey some of the recently proposed wre scheduling strtegies. As will be seen, this previous work ssumes some specific SLA shpes nd designs scheduling policies ccordingly, nd very often, the SLA shpes re piecewise liner. Guirguis et l. [4] im to minimize trdiness s shown in Fig. 2(d), which is i) zero if query is finished before its dedline, or ii) the query s finish minus its dedline, if the query misses it dedline. They nlyze tht EDF is better choice t minimizing trdiness when the system lod is low, nd SRPT(Shortest Remining Processing Time) is better choice when the lod is high. They propose ASETS*, novel scheduling method tht combines EDF nd SRPT using heuristic, nd show tht ASETS* outperforms both EDF nd SRPT over wide rnge of lods. Irwin et l. [8] consider SLA functions in the form of grdully incresing penlty with bound, s shown in Fig. 2(e) nd Fig. 1(c). In order to mximize service provider s profit, they employ two economic concepts, nmely present vlue nd opportunity, nd propose scheduling policy clled FirstRewrd tht combines the two concepts. Irwin et l. focus on the cse of preemptive execution, where query cn be stopped in the middle of execution nd resumed lter, which is often the cse in the supercomputing context. Note tht we ssume non-preemptive execution in this pper, which is often the cse in dt-intensive computing, such s dtbse query execution. Lstly, note tht FirstRewrd s scheduling decision tkes O(N 2 ), where N is the number of queries in the queue, nd this my cuse significnt performnce overhed. Peh [11] proposes scheduling nd dmission control method by using priority token bnk. It is ssumed tht jobs cn be grouped into N clsses nd jobs in ech clss re treted eqully (by using FIFO). Becuse different clsses hve different profiles (e.g., gurnteed or best-effort, different s for missing dedlines, etc.), prioritiztion scheme is designed to choose the next clss to serve. This method ssumes job clsses (videos, emils, etc.) nd does not differentite jobs within the sme clss. Therefore it is much more restricted thn the frmework, in which ech query cn hve its own profile. In[1], we study stircse-shped SLAs s shown in Fig. 2(c). We build dt structure, clled SLA-tree, to cpture the SLAs of the queries in the queue nd propose greedy lgorithm to improve given scheduling lgorithm. However, the SLA-tree bsed scheduling lgorithm in [1] cn only be used to improve n existing scheduling lgorithm nd it cn only hndle stircse-shped SLAs. While this previous work focuses on specific types of SLA function, (which we will introduce in detil momentrily) supports ll types of SLA functions. Also, our i supports ll piecewise liner SLA functions, which is much more expressive thn the functions in most of the previous work. We will compre the performnce of i with tht of some previous work mentioned bove in the experiment section. 2.4 Cost bsed Scheduling () in Detil is -bsed scheduling lgorithm proposed by Peh nd Tobgi [1, 12]. The gol of is to schedule queries in the queue, where ech query hs its own SLA in terms of, in wy tht minimizes the totl expected. However, chieving such miniml, even for the offline cse where future rrivls of queries re known beforehnd, is n NP-complete problem. The heuris- 565
tic used by is to compute priority score for ech query q in the queue bsed only on (1) q s SLA nd (2) how long q hs been witing in the queue. Becuse the priority score of q is computed independently from other queries in the queue, nd becuse the query with the highest vlue for the computed priority is chosen for execution, hs complexity of O(N) for mking scheduling decision when there re N queries in the queue. More specificlly, for ech query q in the queue, computes n expected reduction of executing q immeditely, rther thn delying it further. The expected reduction t given t (where t is the when the system schedules the next query to execute) is computed by r(t) e τ f(t t +τ)dτ f(t t ) (1) where t is the t which the query rrives to the system nd is free prmeter (the only prmeter) to be set by. For convenience, in the rest of the pper, we refer to the expected reduction r(t) computed by t t s the score t t. To intuitively describe how works, in Fig. 3 we illustrte how the score is computed t t nd t for query q with SLA of Fig. 2, nd we ssume the query rrives to the system t t. Fig. 3 shows how the score t t is obtined. At t, if q is served immeditely, the will be f(t t ) c. If, on the other hnd, we decide to postpone q, then it is ssumed tht q will sty in the queue for n mount of witing τ tht follows n exponentil distribution with men 1/. So the expected for postponing q is e τ f(t t +τ)dτ. The score is the net gin of choosing to serve q now insted of postponing it further 1. t e τ c t t t+ t t c t e τ t+ Figure 3: The intuition of : how scores re computed t t nd t t. So s cn be seen from Fig. 3, there re two fctors tht ffect the score of q. The first fctor is the SLA of q, i.e., the vlues of c, c 1, nd t 1; the second fctor is how long q hs been witing in the system. This second fctor cn be illustrted by compring Fig. 3 with Fig. 3. Compred with the sitution t t, t t, q hs been witing in the system longer, nd its dedline for the next jump in the SLA (the jump t t +t 1) is more urgent. As result, its score, which is reflected by the shded res in the figures, hs grown higher. 1 In the originl formul [12], the query execution q s ofqueryq is usedtoderivethe rel urgency ofq (i.e., the when the execution of q hs to be strted). In ddition, thescore ofq isr(t)/q s instedofr(t). Forconvenience, without loss of generlity, we describe s if q s were, nd use r(t) insted of r(t)/q s. In Appendix B.2, we show tht we cn compenste these differences by shifting nd scling the SLA of q. Some dditionl discussions bout re given in Appendix B, in which (1) we offer more detils on, (2) we prove tht for, without loss of generlity we cn lwys set c in piecewise liner SLAs, nd (3) we discuss two fctors, the multi-progrmming-level (MPL) nd the errors in the estimtion of query execution, tht my ffect the effectiveness of. From Eqution (1) we cn see tht is inefficient in tht t ech of scheduling, score hs to be computed for ech query in the queue nd ech computtion involves n integrtion. Assuming there re N queries witing in the queue nd ssuming no new query rrives, the totl number of scores to be computed in order to finish the N queries one by one is N 2 /2. As consequence, the verge for online scheduling of ech query is O(N). To llevite such expensive computtion of, in the next two sections, we propose n efficient incrementl version of, nmely i, tht hs O(log 2 N) complexity under piecewise liner SLAs. 3. I WITH O(logN) COMPLEXITY We develop our incrementl vrition of, i, in this section nd the next. For certin specil forms of piecewise liner SLAs, nmely those described in Figs. 2 2(d), i is ble to chieve n O(logN) complexity (compred with O(N) for originl ). We postpone i for the generl piecewise liner SLAs, nmely those described in Figs. 2(e) nd 2(f), to the next section. 3.1 Score without Integrtion We strt by showing method to compute the scores under piecewise liner SLAs without conducting ny integrtion. The method is bsed on cnonicl decomposition of piecewise liner SLAs nd on rules of clculus. We provide the derivtion detils in Appendix C nd give the finl formul, for the SLA described in Fig. 2(f), s the following r(t) 1 s s+(j1+s1 )e ( t) s2 s1 +(j 2+ )e (t 2 t) (2) where s, s 1, nd s 2 re the slopes of the SLA segments; j 1 nd j 2 re the heights of the jumps t t 1 nd t 2. Note tht Eqution (2) is vlid only for t < t 1. Therefore, when SLAs re piecewise liner, we cn efficiently compute scores t ny t by evluting the exponentil vlues t the plces where SLA segments chnge, without conducting ny integrtion. 3.2 i for the SLA in Figure 2 It cn be esily shown tht in, if the SLA is simple liner function, like tht in Fig. 2, then the score r(t) is constnt over t. The reson is tht by reshuffling Eqution (1), we hve r(t) e τ [f(t t +τ) f(t t )]dτ e τ bτdτ b/ where b is the slope of the liner SLA. So s cn be seen, in such cse, ech query hs -invrint score nd so incrementl cn be trivilly implemented by using priority queue, with n O(log N) complexity. 566
3.3 i for the SLA in Figure 2 To hndle the SLA in Fig. 2, we first derive tht for step-function SLA with height c 1, the score is score score r(t) c 1 e (t 1 t) e t where c 1 e t 1, nd t is the when the score is computed. Note tht the bove formul is vlid only for t < t 1 nd fter t 1, r(t) becomes. We cn see tht in this cse r(t) is -vrying. However, key observtion is tht does not cre the bsolute vlue for ech individul r(t), but insted cres bout the reltive order mong the r(t) s for ll the queries. This is becuse tht only hs to pick the top query with the highest score to be executed next. Therefore s long s the scores mong ll queries shre the sme fctor e t, their reltive order is -invrint ndonlydependsont, whenqueryrrives, t 1, when the dedline is, nd c 1, the of missing the query s dedline (recll tht without loss of generlity, we ssume c ). Therefore, this cse of step-function SLA cn be hndled by using priority queue ordered by the vlues of the queries (where vlues re -invrint), gin with n O(log N) complexity. 3.4 i for the SLA in Figure 2(c) Before hndlingslasin Figs. 2(c) nd2(d), we firststudy more generl cse s described in Fig. 4. Note tht in this more generl cse, the SLA is before t +t 1 nd n rbitrry function (which we denote by blob) fterwrd. Nowwestudyhowthe scorechngesover. Itturns out tht between t nd t +t 1, the score chnges in prticulr pttern. To see this, we compute the scores t two instnces, t nd t, where t < t < t < t +t 1. At t, we hve r(t ) e τ f(t t +τ)dτ f(t t ) nd t t we hve (derivtion given in Appendix B.5) r(t ) e (t t ) r(t ) (3) As consequence we cn see tht the score for the SLA in Fig. 4 grows exponentilly with prmeter until t +t 1, s shown in Fig. 4. t t t+ blob t score t t+ Figure 4: An SLA with zero until t +t 1 nd how the score chnges over exponentilly between t nd t +t 1. Now we come bck to the piecewise liner SLA described in Fig. 2(c). It cn be shown tht its score chnges over s described in Fig. 5. The bsic ide is tht t ech segment of the SLA, we cn shift down the stircses to get n SLA similr to tht in Fig. 4, where the blob is replced by the remining stircses. As elpses, s long s we re still in the sme segment, the score grows in n exponentil fshion, s we hve just shown. In ddition, t2 Figure 5: Left: how the score chnges over for the SLA in Fig. 2(c). Right: how the score chnges over for the SLA in Fig. 2(d). the exponentil rte is the sme for ll the segments nd for ll the queries, becuse the rte only depends on. Bsed on ll these properties, we develop n incrementl by using two priority queues. Both priority queues keep ll the queries, but with different priority scores. In the first priority queue, the score for ech query q is the score for q if we consider the remining stircses of q s blob. Following the sme ide s shown in the cse of SLA in Fig. 2, the reltive order mong the queries in the first priority queue remins fixed. So the problem is boiled down to detecting when ech query chnges its SLA segments (nd so chnges the shpe of the blob). For this, we use the second priority queue. In the second priority queue, the score for ech query q is the when the next jump will hppen in q s SLA, or in other words, the when q s current SLA segment will expire. At ech t when we need to select the next query to execute, we first tke out ll those queries whose SLA segments expired before t. For these queries, the old blobs re not vlid nymore nd so for ech such query q, we locte q s current SLA segment tht overlps t, get q s new of-expirtion of current SLA segment, nd reinsert q into the second priority queue. At the sme, we updte q s score in the first priority queue to reflect its new score. This second priority queue ctully mkes sure tht ll the queries re in their first segment of (probbly revised, if the old first segments hve expired) piecewise liner SLAs. Tht is, for ll queries, t < t 1 is lwys true in r(t), nd therefore Eqution (2) is lwys vlid. As cn be esily shown, the numbers of de-queue nd en-queue opertions for query q in the first nd second priority queues re both bounded by the number of segments in q s SLA, which we ssume to be bounded by constnt. So the mortized complexity is still O(log N) for scheduling ech query. 3.5 i for the SLA in Figure 2(d) For SLAs in Fig. 2(d), it cn be shown tht its score chnges over s described in Fig. 5, where initilly it grows exponentilly with rte nd fter t 1, it becomes constnt. So we cn use the similr ide s before, except tht we need three priority queues. The first nd the second ones re the sme s before, except when query is popped out from the second queue, it is never inserted bck; insted, it is removed from both the first nd the second priority queues nd is inserted into the third priority queue. This is becuse t the of being popped out of the second priority queue, q hs no further SLA segment chnges nd so its score becomes -invrint. When scheduling the next query to execute, fter updting queries in the first nd second priority queues, we compre the query with the highest score in the first priority queue nd tht in the third queue, nd pick the one with the higher score to execute. The complexity clerly is still O(log N). 567
4. I WITH O(log 2 N) COMPLEXITY In this section, we investigte the incrementl version of for generl piecewise liner SLAs, s described in Figs. 2(e) nd 2(f). We will nlyze why these cses re more difficult thn the previous cses. Then we describe n efficient method by using dynmic convex hull lgorithm in computtionl geometry. 4.1 Why the Difficult Cses Are Difficult Strting from Eqution (2), with certin derivtion we cn show tht the score t t for query q, who hs generl piecewise liner SLA, cn be written s f(t) α+e t, (4) where α nd re constnt vlues totlly determined by q s rrivl nd its SLA. It is obvious from Eqution (4) why n incrementl version of is hrd to get. Fig. 6 illustrtes for three smple queries with different α s nd s, how their scores chnge over. As cn be seen from Fig. 6, the reltive order of the scores of the three queries chnges over. In other words, in generl, the order mong the scores of the queries is different depending on the t when we sk bout tht order. Such property poses difficulties to n incrementl version of in the spce. To ddress such difficulties, in the following we investigte different view of the problem: we study the problem in the dul spce of liner functions. score q 3 α 2 q 2 q α 1 1 3 2 1 Figure 6: How the SLA scores of three fictitious queries chnge over. The three queries in the dul spce, with the ffine-lines for scheduling. 4.2 A Dul Spce View of Now we provide new perspective of viewing the score f(t) α+e t. First, we define newvrible ξ e t (where ξ cn be considered s wrped line) to get α 3 α f(ξ) α+ξ, (5) where ξ is -vrying but α nd re constnts. Note tht there is one-to-one mpping between ξ nd t. Then, we put ech of these score functions into the dul spce of liner functions. Tht is, ech function f(ξ) α + ξ is mpped to point in the dul spce with coordinte (α,), s shown in Fig. 6. Next, we exmine t given t, how to determine the order mong the scores. With ξ e t, t t, we cn tret ξ s fixed nd look for the query tht mximizes f(ξ ) α + ξ. If we consider α nd s vribles, then in the dul spce, those points (α,) tht stisfy f(ξ ) α + ξ c re on n ffine line α c ξ, s shown in Fig. 6. So t given t, here is wy we cn get the point in the dul spce tht corresponds to the query with the highest score t t. We first get ξ e t -ξ nd construct n ffine line with slope ξ. Then strting from the upper-right corner of the dul spce, we move the ffine line towrd the lower-left corner of the dul spce while keeping the slope fixed t ξ. The first point hit by the moving ffine line will be the query tht hs the highest score t t. Figs. 7 nd 7 show the sme set of three queries, whose scores re compred t two different, t (with ξ e t ) nd t (with ξ e t ), wheret < t. Ascnbeseen, terlyt, the(bsolute) slope of the ffine line is smller nd so the point (α 3, 3) hs the highest score; s going, t t, (α 1, 1) hs the highest score becuse it hs higher vlue. α α 3 α 2 -ξ α 1 3 2 1 α α 3 α 2 α 1 3 2 1 Figure 7: Selecting the query with the top score t t nd t t. In summry, the dvntge of this dul-spce pproch is tht in the dul spce, we fix the (α,) loction of ech query s -invrint; nd over the we chnge the slope of the scheduling ffine line to select the query with the highest score t ny given moment. This dulspce perspective, s we show in Appendix D.1, lso offers insights bout why the cses in Section 3, i.e., those SLAs in Figs. 2 2(d), cn be hndled with O(logN). 4.3 A Convex Hull bsed Algorithm In this subsection, we develop i under generl piecewise liner SLAs tht tkes dvntges of this dul-spce view. The first question is whether we cn efficiently mintin the position of query q in the dul spce over. The nswer is ffirmtive, s the position of q in the dul spce cn only chnge finite number of s (which turns out to be bounded by the number of segments in q s SLA). We formlly prove this in Appendix D.2. Second, it cn be seen from Fig. 8 tht necessry condition for point q to be hit first by the moving ffine line is tht q is on the (upper) convex hull of ll points in the dul spce. Furthermore, it cn be shown tht if the convex hull is mintined properly, t ny t, finding the point hit first by the ffine line of slope -ξ (i.e., with ξ e t ) cn be done in O(logM), where M is the number of points on the convex hull (obviously, M N). More specificlly, if the points of the convex hull re sorted by their vlues, s shown in Fig. 8, then the ngles of the edges on the convex hull re in n monotoniclly decresing order. At t, we hve fixed slope -ξ, nd the condition for q on the convex hull to be the point hit first by the ffine line of slope -ξ is tht the slope -ξ is between the ngles of the two edges tht incident to q. This cn esily be done by conducting binry serch on the convex hull. Therefore, it follows tht we cn develop i s long s we cn (1) efficiently detect when query chnges its segment in its SLA nd (2) incrementlly mintin convex hull tht supports dding nd deleting points dynmiclly. For item (1), s discussed before, we cn mintin priority -ξ 568
α -ξ Figure 8: The queries with the highest score cn only be on the upper convex hull in the dul spce. The ngles of the edges on the convex hull follow monotonic decresing order. queue of queries ordered by the of the expirtion of the current SLA segment. At ny t, we cn quickly locte those queries whose current SLA segments hve expired before t, nd updte their new current SLA segments together with new expirtion of the current SLA segments. For item (2), we dopt, from the field of computtionl geometry, dynmic convex hull lgorithm for points in 2-D plne tht hs O(log 2 N) complexity [13]. The detiled implementtion of the i lgorithm, s well s the nd spce complexity nlysis, re given in Appendix D.3. An intuitive interprettion of i is tht it incrementlly mintins (1) the snpshot of the scores of ll the queries in the dul spce nd (2) the convex hull of the snpshot. At ech t of mking scheduling decision, i quickly brings up-to-dte both the snpshot nd the convex hull, from which the query with the top score t t cn be locted very efficiently. 5. EXPERIMENTAL STUDIES The experiments re composed of two sets. First, we verify the good performnce of (i 2 ), in terms of optimiztion, by compring it with severl other stte-ofthe-rt -wre scheduling lgorithms. Second, we compre the running of i with tht of the originl under vrious worklods. Some dditionl results re given in Appendix E. 5.1 Scheduling Effectiveness Verifiction In this subsection, we verify the performnce of (i) using two different types of SLA functions. We compre i with two pieces of previous work, ASETS* [4] nd FirstRewrd [8], s described t the beginning of this pper. For the query execution we use n exponentil distribution with men µ 3ms; for the rrivl rte we use Poisson rrivl with rte 1/λ, which is determined by µ nd the required lod. The dt set contins 2K queries, where the first 1K re used for system wrm-up. The first SLA function is shown in Fig. 1, which is lso known s weighted trdiness [4]. We set the dedline t 1 for ech query s 1 s its execution. Following the experiment design by [8], we choose the slope vlue from one of two clsses, high nd low, where hlf of queries get high slope vlues nd hlf get low slope vlues. Within ech clss, we choose the specific slope vlue from norml 2 In terms of the prmeter used in, Peh [1] showed tht the performnce is not sensitive to the exct vlue of s long s is in resonble rnge. So following Peh s suggestion, we simply used 1µ where µ is the men execution of query. α distribution with men nd stddev.2*men. The rtio between highmen ndlowmen is controlled bydecy skew fctor, which we vry in the experiment. Note tht ASETS* [4] is explicitly designed for this first SLA function. The second SLA function is shown in Fig. 1(c). Ech query incurs fter the minimum t 1, nd there is bound t 1 s the execution (t 2), which differentites it from the weighted trdiness bove. The bound vlue is chosen from two norml distributions s described bove, nd the rtio of high men nd low men is clled vlue skew fctor. Note tht FirstRewrd [8] is explicitly designed for this second SLA function. Tble 1(left) shows the result on the first SLA function under different decy skew fctors s described bove. When the system lod is.8, the three -wre scheduling lgorithms lredy significntly outperform the unwre counterprts, nmely FCFS nd SJF. The improvement become more striking when the system lod is incresed to.95. Among the three -wre scheduling lgorithms, i clerly outperforms the other two, especilly whenthesystemlod ndthedecyskewfctor rehigh(exctly when differentited services re needed the most). For exmple, under system lod of.95 nd decy skew fctor of 128, i outperforms the second best lgorithm by 45%. Tble 1(right) shows the result on the second SLA function under different vlued skew fctors s described bove. (We do not compre the performnce with ASETS*, becuse ASETS* cnnot hndle this SLA.) As cn be seen, lthough the mrgin is smller, i still consistently outperforms FirstRewrd, which ws designed specificlly for this second SLA, by bout 1%. 5.2 Scheduling Efficiency Study In this subsection, we investigte the performnce of i in terms of running 3. As for the bseline, for fir comprison, we implement so tht it computes scores under piecewise liner SLAs without conducting integrtion, s described in Section 3.1. All the running s re reported on Xeon PC with 3GHz CPU nd 4GB memory, running Fedor 11 Linux. When the system hs light lod, the number of queries to be scheduled is very smll in most of the with exponentilly distributed execution s. Therefore, in this experiment we focus on the cse when the system lod is.95, to study the sitution when the system is borderline overloded. Fig. 9 shows the running vs. the number of queries to be scheduled for nd i. As cn be seen, while exhibits cler O(N) behvior, the online scheduling of i is lmost unffected by N. It is worth noting tht FirstRewrd on verge needs couple of seconds to mke ech scheduling decision, which mkes it imprcticl for mny pplictions. Finlly, we study cse tht emultes the scenrio with mixture worklod with OLAP nd OLTP queries. Query execution in such cse cn be cptured by Preto (e.g., long-til) distribution. Following [5], we set the minimum vlue of the Preto to be 1ms nd the Preto index to be 1. We use lod of.8 becuse even with such light lod, the number of queries to be scheduled cn grow very 3 We implemented nive version of incrementl convex hull insted of using the sophisticted version in [13], nd in our experiments it is never bottleneck. Detils re skipped due to the spce limit. 569
Tble 1: Averge per query, for different lgorithms under different skew nd lod fctors. SLA Type SLA-1 SLA-2 Worklod.8.95.8.95 Skew Fctor 2 8 32 128 2 8 32 128 2 8 32 128 2 8 32 128 FCFS.62.186.821 2.859.569 1.769 6.943 19.7.13.38.139.543.28.87.316 1.284 SJF.8.24.118.364.13.324 1.289 3.662.8.25.92.358.14.43.156.628 ASETS*.5.12.51.175.66.19.237.619 - - - - - - - - F-REWARD.5.13.49.176.69.12.21.49.7.18.59.223.1.23.77.296 i.5.12.45.158.66.92.146.273.7.16.53.2.1.22.68.26 per scheduling (ns) 2 1.5 1.5 x 1 4 SLA 1 (Exp) i 1 2 queue size per scheduling (ns) 15 x SLA 2 (Exp) 14 i 1 5 1 2 queue size Figure 9: Averge scheduling per query for the Exponentil cse with Lod.95. lrge (becuse of OLAP queries my occupy the dtbse server for rther long ). Note tht for this experiment, FirstRewrd ws not ble to finish within resonble (hours). Fig. 1 shows the performnce comprison nd we cn drw similr conclusions s before in terms of the running of i. One observtion is tht in this cse, while the to mke scheduling decision for i is extremely fst (less thn.1ms), tht for the originl cn become tens of milliseconds, n overhed uncceptble in mny dtbse pplictions. per scheduling (ns) 16 x SLA 1 (Preto) 16 1 x SLA 2 (Preto) 16 14 i i 8 12 1 8 6 4 2 5 queue sizex 1 4 per scheduling (ns) 6 4 2 1 2 queue sizex 1 4 Figure 1: Averge scheduling per query for the Preto cse with Lod.8. 6. CONCLUSION We investigted -bsed scheduling lgorithm,, which hs superior performnce in terms of SLA nd therefore hs gret potentils in cloud computing. The min focus of this pper ws to implement in more efficient wy, where the is determined on query by using piecewise liner SLAs. To chieve this gol, we developed n incrementl vrition of, clled i, tht gretly reduces the computtion during online scheduling. i cn hndle ny type of piecewise liner SLAs, which re very common in cloud computing contrcts, with very competitive complexity. 7. ACKNOWLEDGMENTS We thnk Jeffrey Nughton for the insightful discussions nd his contributions. 8. REFERENCES [1] Y. Chi, H. J. Moon, H. Hcigumus, nd J. Ttemur. SLA-tree: A frmework for efficiently supporting SLA-bsed decisions in cloud computing. In EDBT, pges 129 14, 211. [2] A. Gnpthi, H. A. Kuno, U. Dyl, J. L. Wiener, A. Fox, M. I. Jordn, nd D. A. Ptterson. Predicting multiple metrics for queries: Better decisions enbled by mchine lerning. In ICDE, pges 592 63, 29. [3] D. Gmch, S. Krompss, A. Scholz, M. Wimmer, nd A. Kemper. Adptive qulity of service mngement for enterprise services. TWEB, 2(1):1 46, 28. [4] S. Guirguis, M. A. Shrf, P. K. Chrysnthis, A. Lbrinidis, nd K. Pruhs. Adptive scheduling of web trnsctions. In ICDE, pges 357 368, 29. [5] C. Gupt, A. Meht, S. Wng, nd U. Dyl. Fir, effective, efficient nd differentited scheduling in n enterprise dt wrehouse. In EDBT, pges 696 77, 29. [6] H. Hcıgümüş, J. Ttemur, W. Hsiung, H. J. Moon, O. Po, A. Swires, Y. Chi, nd H. Jfrpour. CloudDB: One size fits ll revived. In IEEE World Congress on Services (SERVICES), pges 148 149, 21. [7] J. R. Hrits, M. J. Crey, nd M. Livny. Vlue-bsed scheduling in rel- dtbse systems. The VLDB Journl, 2:117 152, April 1993. [8] D. E. Irwin, L. E. Grit, nd J. S. Chse. Blncing risk nd rewrd in mrket-bsed tsk service. In HPDC, pges 16 169, 24. [9] J. Leung, L. Kelly, nd J. H. Anderson. Hndbook of Scheduling: Algorithms, Models, nd Performnce Anlysis. CRC Press, Inc., 24. [1] J. M. Peh. Scheduling nd dropping lgorithms to support integrted services in pcket-switched networks. PhD thesis, Stnford University, 1991. [11] J. M. Peh. Scheduling nd dmission control for integrted-services networks: the priority token bnk. Computer Networks, 31(23-24):2559 2576, 1999. [12] J. M. Peh nd F. A. Tobgi. A -bsed scheduling lgorithm to support integrted services. In INFOCOM, pges 741 753, 1991. [13] F. P. Preprt nd M. I. Shmos. Computtionl geometry: n introduction. Springer-Verlg New York, Inc., New York, NY, USA, 1985. 57
APPENDIX A. CLOUD COMPUTING ARCHITECTURE Fig. 11 shows severl components tht we believe re crucil in cloud computing system. A cpcity plnning component plns (offline) nd mnges (online) the repliction nd system resources; disptching component disptches queries to pproprite servers in -wre wy; loclly t ech server, -wre scheduling lgorithm mkes besteffort scheduling to minimize the SLA mong queries disptched to the server. queries rrive q5 q4 queries rrive q3 query buffer scheduling q2 q1 cpcity plnning repliction migrtion re provisioning... disptching S dtbse sever query execution complete Figure 11: Components in cloud system. Idelly, we prefer comprehensive optimiztion by considering ll the bove components in globl wy. However, we hve concerns bout such globl optimiztion in terms of its dptbility to quick chnges nd sclbility to lrge numbers of clients in the cloud. Therefore, we choose to use modulr pproch where locl optimiztion is mde in ech component, nd in this pper we only focus on the -wre scheduling component. B. MORE DETAILS ABOUT In this ppendix, we discuss more detils bout, including the equivlence between SLAs nd profit SLAs, more detils of, setting c in piecewise liner SLAs for, some fctors tht my ffect the performnce of, nd the detiled derivtion of Eqution (3). B.1 Cost SLAs vs. Profit SLAs In our pper, to be consistent with the terminology used in the originl lgorithm, insted of using query profit, we use query. These two re equivlent due to the following reson. As shown in Fig. 12, we cn decompose profit SLA into the difference between constnt profit SLA nd SLA. Tht is, we cn ssume for ech query the service providerobtinsprofitofg 1 upfront, ndpysbck certin depending on the query, where the mximl pybck is g 1 +p 1. So the totl profit mong ll queries is the difference between the totl profit up front nd the totl. From the point of view of scheduling lgorithm, the totl upfront profit cn be considered s constnt, depending on the shpe of SLAs nd the worklod, which is beyond the control of the scheduling lgorithm; the totl is the prt tht scheduling lgorithm cn control, by chnging the priority mong queries, where minimizing the totl is the finl objective. g1 p1 profit t2 g1 profit g1+p1 t2 S1 S2 Sm Figure 12: Equivlence of profit nd SLAs. B.2 More Detils bout Score r(t) There re severl things we wnt topoint out bout Eqution (1). First, the score r(t) is -vrying. This mkes sense becuse the urgency of query depends on how long the query hs been witing in the queue so fr nd s result, it depends on the t when the score is computed. Second, the f(t t ) term in r(t) is the for executing query q right now (i.e., t t). Third, inside the integrtion, the dummy vrible τ indictes the further dely for query q nd f(t t +τ) is the corresponding. In the originl, the score for query q is r(t) divided by q s, the execution of q. However, equivlently we cn scle the SLA of q by 1/q s nd therefore use r(t) computed from the scled SLA s the score. In ddition, for simplicity of discussion, in this pper we illustrte the exmples s if the execution q s were. A non-zero execution q s cn be hndled by shifting q s SLA to the left by n mount of q s. These djustments re ctully implemented in ll our lgorithms mentioned in this pper. B.3 Why We Cn Set c under One observtion tht cn be obtined from Eqution (1) is tht without loss of generlity, to compute score, we cn ssume f(t ). This is becuse (s shown in Fig. 13) r g(t) e τ g(t t +τ)dτ g(t t ) e τ [f(t t +τ)+c ]dτ [f(t t )+c ] r f (t) where the lst step relies on the fct tht e τ is probbility density function nd therefore e τ c dτ c. This result reflects key feture of, where the dmge done so fr cn be ignored. Becuse of this property, in this pper, without loss of generlity, we ssume f(t ), nd therefore ll the c s in Figs. 2 (f) cn be set to. f(t) t t g(t)f(t)+c Figure 13: The illustrtion of why without loss of generlity, we cn ssume f(t ) in ll the SLAs. B.4 Fctors Tht Affect There re mny fctors tht potentilly ffect the effectiveness of. One of the fctors is the multi-progrmminglevel (MPL) of the dtbse. However, should not be very sensitive to MPL, becuse the score of query q only depends on q s SLA function nd q s urgency. The former is not relted to MPL nd the ltter is pproximted in by using n exponentil distribution, which is not sensitive to the exct MPL of the dtbse. Our experimentl studies, skipped due to the spce limits, hve verified this conjecture. Another fctor tht ffects the effectiveness of is how ccurte we cn estimte the query execution. We rgue tht fully -wre scheduling lgorithm hs to tke query execution into considertion (in this sense EDF is not fully -wre, becuse it only considers query dedlines but not query execution ). Otherwise, the urgency c t t 571
of query is not ccurtely cptured. To estimte query execution, recently work (e.g., [2]) hs strted using mchine lerning techniques nd obtined encourging results. In ddition, our own investigtion (prtly reported in [1]) demonstrte tht cn tolerte errors in the estimtion of query execution to certin levels. Specificlly, when the stndrd devitions of the errors re.2 nd 1., the performnce degrded by 1% nd 3%, respectively. B.5 Derivtion of Eqution (3) Here we provide the derivtion of Eqution(3) nd discuss some technicl subtleties. nd We hve r(t ) r(t ) e τ [f(t t +τ) f(t t )]dτ e τ [f(t t +τ) f(t t )]dτ e τ [f(t t +τ +t t ) f(t t )]dτ e (t t ) e η [f(t t +η) f(t t )]dη t t e (t t ) r(t ) where in the derivtion we defined new dummy vrible η τ + t t nd in the lst step, we used the fct tht f(t t +η) f(t t ) for η t t. This feture of is ctully due to the memory-less property of the exponentil distribution e τ, nmely t ny given, the conditionl distribution of the remining witing τ for query in the queue is the sme s the originl distribution of the totl witing. In ddition, techniclly, the blob in Fig. 4 is not relly rbitrry: the function hs to mke the integrtion in the score finite. However, such condition is stisfied by ny piecewise liner function with finite segments. C. FAST COMPUTATION OF SCORE UNDER PIECEWISE LINEAR SLAS In this ppendix, we derive n efficient pproch for computing scores of queries with piecewise liner SLAs. This pproch, by pplying cnonicl decomposition of piecewise liner SLAs nd by using rules of clculus, voids the expensive integrtion in the computtion of scores. Suchn efficient pproch, otherthn mkingit fst tocompute scores, revels importnt insights bout under piecewise liner SLAs. These insights turn out to be key to i, our incrementl implementtion of. C.1 Decomposition of Piecewise Liner SLAs We strt with cnonicl decomposition of generl piecewise liner SLA. We illustrte the decomposition by using the SLA described in Fig. 2(f), which is reproduced on the left in Fig. 14 s f 1. As shown in Fig. 14, the SLA cn be prtitioned into three segments: tht before t 1, tht between t 1 nd t 2, nd tht fter t 2. Strting from f 1, we decompose the SLA into the sum of f 2, which is continuous function, nd f 3 nd f 4, which re step functions tht cpture the jumps in the s of the SLA. Next, we tke the derivtive of f 2 to get f 2, which in turn cn be decomposed into the sum of f 5, which is constnt function corresponding to the initil slope of the SLA, nd f 6 nd f 7, which re step functions tht cpture the jumps in the slopes of the SLA. (Note tht f 2(t) is not defined t t 1 nd t 2, which is fine becuse f 2(t) is continuous nd finite.) It cn be shown tht in Eqution (4), the α vlue of score for piecewise liner SLA is determined by f 5 in Fig. 14, nd the vlue is determined by f 3, f 4, f 6 nd f 7 in Fig. 14. f1 c2 s s1 t2 s2 j2 j1 f2 s2 s s1 derivtive j1 j2 t2 f3 t2 f4 + + t2 s2 s s1 s s1 s s2 s1 f 2 t2 f5 f6 f7 + + t2 Figure 14: The decomposition of generl piecewise liner SLA f 1 into the sum of f 2, f 3, nd f 4, wheres f 2, the derivtive of f 2, is further decomposed into the sum of f 5, f 6, nd f 7. C.2 Fst Computtion of the Score It turns out tht with the help of the bove cnonicl decomposition, we re ble to compute the scores under piecewise liner SLAs without ny integrtion. We derive this result by using the decomposition shown in Fig. 14. The score r(t) for t < t 1 is computed s r(t) e τ f 1(t t +τ)dτ f 1(t t ) (6) where without loss of generlity we set f 1(t ) to be. For the step function f 3(τ), it cn be esily shown tht e τ f 3(t t +τ)dτ j 1 e (t 1 t), where t 1 is the when f 3 jumps from to vlue of j 1. We cn obtin similr result for f 4. Becuse integrtion is liner opertion, we hve r(t) e τ f 1(t t +τ)dτ f 1(t t ) e τ f 2(t t +τ)dτ f 1(t t ) +j 1 e (t 1 t) +j 2 e (t 2 t) e τ [f 2(t t +τ) f 2(t t )]dτ +j 1 e (t 1 t) +j 2 e (t 2 t) where we used the fct tht f 1(t t ) f 2(t t ) for t < t 1. The min technique we use next is the well-known rule of integrtion by prts in clculus: g (τ)f(τ)dτ f(τ)g(τ) g(τ)f (τ)dτ. (8) (7) 572
Compring Eqution (8) with the integrtion prt of the score in Eqution (7), nd by setting g(τ) e τ which implies tht g (τ) e τ, we hve g (τ)[f 2(t t +τ) f 2(t t )]dτ g(τ)[f 2(t t +τ) f 2(t t )] 1 Now from f 5, we hve 1 g(τ)f 2(t t +τ)dτ e τ f 2(t t +τ)dτ. e τ f 5(t t +τ)dτ 1 s, nd it cn be esily shown tht from f 6 nd f 7, 1 1 e τ s1 s f 6(t t +τ)dτ e ( t), e τ f 7(t t +τ)dτ which give the finl result r(t) 1 s2 s1 e (t2 t), s s+(j1+s1 )e ( t) s2 s1 +(j 2+ )e (t2 t). D. MORE DETAILS ABOUT I In this ppendix, we provide more detils bout i, including insights obtined from the dul-spce view, the correctness of n incrementl mintennce in the dul spce, the detiled i lgorithm, nd its complexity nlysis. D.1 Why the Esy Cses Are Esy With the dul-spce interprettion, now we cn revisit the esy cses in Section 3 nd see why they re esy to hndle. The queries with SLA of Fig. 2 re locted in the dul spce on the α-xis, s shown in Fig. 15. So no mtter when the scores re checked (i.e., no mtter with wht slope we hit the points using n ffine line), the best one is lwys the one with the highest α vlue. Similrly, the SLAs of Figs. 2,(c), nd (d) re shown in Fig. 15, where they re ll on the -xis in the dul spce. In this cse, no mtter using wht slope, the ffine line lwys hits the one with the highest vlue. All these clerly illustrte tht for cses of SLAs in Figs. 2 (d), the scores re order-preserving over (except when n SLA segment expires), nd so they re esy to hndle. α 3 α 2 α 1 α Figure 15: The queries in α-stge nd in - stge in the dul spce. For ese of discussion, in the reminder of pper (ppendices), we refer to the queries in Fig. 15 s queries in α-stge nd those in Fig. 15 s queries in -stge. Along the sme line, for those queries tht re neither in α-stge nor in -stge (i.e., those with α nd ), we refer to them s in α-stge. α 3 2 1 D.2 Incrementl Mintennce Is Prcticl We prove tht it is prcticl to incrementlly mintin the convex hull in the dul spce for queries with piecewise liner SLAs. The keyis thefollowing propertyof scores under piecewise liner SLAs. Property 1. Under piecewise liner SLAs, in the dul spce, query q is either in α-stge, or -stge, or αstge. Moreover, the stge of q does not chnge within the sme segment of the piecewise liner SLA of q. Proof. Here we give sketch of the proof bsed on the decomposition of piecewise liner SLAs. Fig. 16 shows tht generl piecewise liner SLA for query q cn be decomposed into liner prt nd blob prt, where the liner prt determines the α vlue nd the blob prt determines vlue of q. Therefore, we either hve α (nd so q is in -stge), (nd so q is in α-stge), or α nd (nd so q is in α-stge). In ddition, from the figure we cn esily see tht such decomposition remins fixed within the sme segment of the SLA of q. t2 t2 SLA liner prt + blob prt Figure 16: Decomposition of generl piecewise liner SLA into liner prt, which determines α, nd blob prt, which determines. With such property we cn see tht query q cn only chnge its stge nd hence its position in the dul spce (q cn, e.g., chnge from α-stge bck to α-stge.) for finite number of s. And this number is bounded by the number of segments in q s piecewise liner SLA. D.3 i Algorithm in Detil nd Its Complexity Anlysis Fig. 17 nd Fig. 18 give the pseudo code for the i lgorithm. At ech t of scheduling the next query to execute, lgorithm schedulenext() is clled with t, the current stmp, nd newq, those queries tht hve rrived before t but fter the lst when schedulenext() ws clled. In the first step of schedulenext(), lgorithm updte() is clled in order to incrementlly updte the internl dt structures. The internl dt structures mintined by i (see Fig. 18) include (1) -Q: priority query contining queries either in -stge or in α-stge, where for ech query q in -Q, its priority is the q.ǫ, the when the current SLA segment of q will expire, (2) α-q, -Q, nd α-q: priority queues for those queries in α-stge, -stge, nd α-stge, respectively, nd (3) CH: the convex hull in the dul spce for ll the queries in α-stge. When updte() is clled, it first detects those queries whose current SLA segments hve expired before t (line 1). For these queries, their α nd vlues (s well s stges) my hve chnged since lst updte() ws clled. So these queries re removed from the corresponding internl dt structures nd these queries re ppended to the end of newq so tht their α nd vlues will be recomputed (lines 2 7). Then for ll the queries in newq (both those newly rrived nd those tht need updtes), their α nd + 573
Algorithm schedulenext(t,newq) input: t, newly rrived queries newq output: q, the next query to execute 1: cll updte(t,newq); 2: ξ e t ; 3: q α α-q.top(); 4: q -Q.top(); 5: q α CH.get(-ξ); 6: if q α hs the highest score 7: q α-q.pop(); 8: else if q hs the highest score 9: q -Q.pop(); 1: remove q from -Q; 11: else 12: q q α ; 13: remove q α from α-q, CH, nd -Q; 14: return q; Figure 17: Implementtion of schedulenext(). vlues re computed, their stges re determined, their new current SLA segments nd expirtion re updted, nd they re inserted into the corresponding dt structures. After the internl dt structures hve been updted, schedulenext() checks q α, q, nd q α, the three queries tht hve the highest scores in the α-q, -Q, nd α- Q. To get q α nd q, it is suffice to peek t the tops of α-q nd -Q; to get q α, it is suffice to do binry serch on the convex hull CH by using the slope ξ e t. Then the best one mong q α, q, nd q α is selected nd removed from the corresponding dt structures(ssuming this query is ctully executed next). The nd spce complexities of the overll i re given s the following. Property 2. Our i implementtion hs n O(log 2 N) complexity for scheduling ech query, nd it hs n O(N) spce complexity. Algorithm updte(t,newq) input: t, newly rrived queries newq -Q: priority queue on expirtion (ǫ) α-q: priority queue for queries in α-stge -Q: priority queue for queries in -stge α-q: priority queue for queries in α-stge CH: convex hull for queries in α-stge First, hndle queries tht chnge SLA sections 1: forech q in -Q such tht q.ǫ < t do 2: remove q from -Q; 3: ppend q to the end of newq; 4: if q ws in -Q 5: remove q from -Q; 6: else if q ws in α-q 7: remove q from α-q nd CH; Second, (re)insert updted queries 8: forech q in newq do 9: compute q s α,, ǫ vlues; 1: if q is in α-stge 11: insert q to α-q; 12: else if q is in -stge 13: insert q to -Q nd -Q; 14: else /* q is in α-stge */ 15: insert q to α-q, CH, nd -Q; Figure 18: Implementtion of the updte(). Proof. In schedulenext(), lines 3,4,7,9, nd 1 ll hve complexity O(log N), by using n ddressble priority queue or blnced binry serch tree. Line 5 hs complexity O(logN) by using binry serch. Line 13 my involve the updte of the convex hull nd so hs complexity of O(log 2 N). For updte(), ech query q cn enter the loops of lines 1 7 nd lines 8 15 t most K s where K is constnt tht represents the number of segments in q s SLA. Ech step in the two loops hs n O(logN) complexity other thn lines 7 nd 15, in which it tkes O(log 2 N) to dd or remove q from the convex hull dynmiclly. In the bove nlysis, we ssumed K to be constnt. If this is not the cse, then the complexity becomes O(K log 2 N) for i nd O(KN) for. In terms of spce complexity, we notice tht ech query q occurs t most once in -Q nd once in either α-q, -Q, nd α-q, nd in ddition, the size of the convex hull CH is bounded by the size of α-q. So we cn see tht the spce complexity for i is O(N). E. ADDITIONAL EXPERIMENTS In this ppendix, we show the running of vs. i under generl piecewise liner SLAs. The SLAs re in the shpe tht is described in Fig. 2(f), nmely with three segments where s, s 1 nds 2 re non-zero. Fig. 19shows the performnce comprison between nd i, in terms of running under different queue sizes, for query execution following exponentil distribution (Fig. 19-left) nd Preto distribution (Fig. 19-right). Severl observtions cn be obtined from the results. First, the running for obviously scles linerly with respect to the queue size nd for i, the running is reltively insensitive to the queue size. Second, becuse there re more queries in α-stge, the running for i is higher thn tht in Fig. 9 nd hs higher vritions. This is more distinct in Fig. 19-left, where the running for is low due to smller queue sizes. However, even for Preto distribution, the number of queries in their α-stge is not very high (in tens). This is becuse when lrge OLAP query blocks the server, most queries will be in their lst SLA segment, i.e., in α-stge. In other words, the sophisticted incrementl convex hull pproch is not wrrnted in this cse nd the min benefit comes from queries in α nd stges. However, even this is the cse, the dulspce view is still crucil for obtining the benefit of i. per scheduling (ns) 2.5 x SLA 3 Exp 14 i 2 1.5 1.5 1 2 queue size per scheduling (ns) 9 x SLA 3 Preto 15 8 i 7 6 5 4 3 2 1 5 1 queue size Figure 19: Averge scheduling per query for the Exponentil (left) nd Preto (right) cses under generl piecewise liner SLAs, with Lod.95. 574