AnArchitectureforConsumer-OrientedOnlineDatabaseServices PrasadSistlay,OuriWolfsony,SonDaoz,KailashNarayanany,RamyaRajy Abstract Inthispaperweintroduceanarchitectureforonline databaseservicesorientedtowardsconsumers.we identifytwotypesofcosts accesscostandcommunicationcost.wedemonstratethatdynamicallocation ofdatacanminimizethesecosts.wedosobypresentingecientalgorithmsbasedondynamicallocation; thesealgorithmsoptimizeaccessandcommunication costsforvariouscostmodels,accesspatterns,andretrievalprotocols. 1Introduction Wearewitnessingtheemergenceofanewformofcomputing/communicationenvironment,calledconsumer (asopposedtobusiness)computing.insuchanenvironment,tensofmillionsofconsumerswillcarry portablecomputersequippedwithwirelessdatacommunicatorsthatenableaccesstoalargenumberof databases,digitallibraries,andotheronlineservices. Thepotentialmarketforthisactivityisestimatedto bebillionsofdollarsannually.forexample,passengerswillaccessairlineandothercarriersschedules, aswellasweatherinformation.investorswillaccess pricesofnancialinstruments,salespeoplewillaccess priceandinventorydata,routeplanningcomputersin carswillaccesstracinformation,andcallerswillaccesslocationdependentdata(e.g.whereisthenearest doctor[1]). Therewillbetwotypesofchargesincurredinthis information-at-your-ngertipsenvironment,namely accessandcommunicationcharges.accesscharges willbepaidtotheinformationprovider,andcommunicationchargeswillbepaidtothenetworkprovider. thisresearchwassupportedinpartbynsfgrantnumbersiri-9408750andiri-9224605,andafosrgrantnumber F49620-93-1-0059. yelectricalengineeringandcomputersciencedepartment, UniversityofIllinois,Chicago,Illinois60607 zhughesresearchlaboratories,informationscienceslaboratory,malibu,ca Forexample,currentlyRAMMobileDataCorp. chargesonaverage$0.08perdatamessagetoorfrom themobilecomputer(theactualchargedependson thesizeofthemessage),anddatabroadcastingcorp. chargesforprovidingthepricesofnancialinstruments.similarly,thesetwotypesofchargesareincurredtodayinvoicecommunication,whencalling900 numbers. Webelievethatthesechargeswillbethedriving forcethatdeterminestheoverallsystemarchitecture, andtheavailableaccessmodesandprotocols.both typesofchargescanbeoptimizedbythedynamicallocationprinciple.thisprinciplestatesthatwhena customerreadsadata-itemmorefrequentlythanthe dataitemisupdated,thentheamountofdatatransfersisminimizedifthecustomerhasasubscriptionto receiveallthechangestothedataitem;andviceversa, whenacustomerreadsadata-itemlessfrequently thanthedataitemisupdated,thentheamountof datatransfersisminimizedifthecustomerdemands thedataitemfromtheonlineserverateachaccess. Inotherwords,acopyofthedataitemshouldbedynamicallyallocatedanddeallocatedatthecustomer's computer,dependingonthefrequencyofcustomerreadscomparedtothefrequencyofdata-item-writes. Thewayinwhichthisprinciplecanbeapplieddependsontheaccessandcommunicationcoststructures,thetypeofknowledgeabouttheaccesspattern totheonlineservice,andtheretrievalprotocolsthat areused.forexample,ifadatatransferon-demandis twiceasexpensiveasadatatransferbysubscription, thencostisoptimizedifasecondcopyofthedataitem iscreatedwhenthenumberofreadsismorethanhalf thenumberofwrites. Inthispaperwedemonstratetheapplicationofthe dynamicallocationprincipleforcostoptimization.we dosoinanarchitecturewepropose,andforseveral typesofaccesspatterns,costmodels,andretrieval protocols.althoughthearchitectureandthecost modelsseemreasonabletous,werealizethatcurrently
theindustryisinitsinfancy,andthewaythesefactorswillevolvedependsoncompetitivemarketforces andtechnologicaladvancesthatarehardtopredict atthispointintime.however,webelievethatthe principlecanbeappliedinmanyotherscenariosthat willemerge. Weconsiderthefollowingretrievalprotocols.Assumethatacustomeraccessesthepricesofaportfolio ofstocks.theaccesscanusethesubscriptionprotocol,inwhichthecustomerreceiveseveryupdatetoa portfolio-stockprice,ortheon-demandprotocol,in whichthecustomerrequeststheportfoliopriceswhen needed.theon-demandprotocolmayhaveacache- Invalidationoption,inwhich,followingatransferof thedata-itemtothecustomer,theserverinformsthe customerwhentherstupdatetothedata-itemoccurs,withoutprovidingthenewvalue.thesubscriptionprotocolmaybeparameterizedfordivergence,allowingselectivetransmissionofupdates;forexample, thecustomermayrequestarefreshonlywhenhis/her copydivergesfromthemostup-to-datecopyby3updates,or3%,or3minutes(see[2,3,4]). Weenvisionthatthecustomerwilluseoneofthese retrievalprotocols,andtheonethatoptimizesthe accesscostdependsontwofactors:theaccesscost model,andtheaccesspatterntype.furthermore,the usermaybeabletochangetheretrievalprotocolas theaccesspatternchanges.forexample,theusermay retrievebysubscriptionbetween9amand10am,and on-demandbetween10amand11am. Foroptimizingthecommunicationcost,theretrievalprotocolmayalsobeabletomakeuseof thebroadcastoption.specically,theinformation providermaybeabletochoosewhethertobroadcast aparticularupdateitreceives,ortotransmititina point-to-pointfashiontooneormorecustomers.obviously,whenbroadcastinginformationthatinvolves anaccesscost,thedatawillhavetobeencrypted,so thatonlytheownersofadecryptionkeywillbeable todecipherit. Thecostmodelmaybetime-basedorrequestbased,andthecustomermayhaveachoicebetween thetwo.inatime-basedmodel,thereisaatfeeper timeperiod,e.g.amonth.thisenablesthecustomer toreceiveallthepriceupdatestohisstockportfolio. Inarequest-basedmodelthecustomerischargedper transferofinformation,wherethetransfermaybea resultofsubscriptionordemand. Theoptimalretrievalprotocolalsodependsonthe access-pattern.theaccesspatterntoadatabaseview (e.g.thestockportfolio)isthepatternofreads(by thecustomer)andupdates(bythedatabaseserver) oftheview.thetypesofaccesspatternsthatwe consideraredeterministic,partiallydeterministic,and probabilistic.inadeterministicaccess-pattern,the customer/information-providerknowthetimeofeach readandeachupdate(e.g.thecustomermayknow thats/hereadsthevalueofthedatabaseviewevery dayat5pm,andtheviewisupdatedatmidnight). Inapartiallydeterministicaccesspattern,foreach timeslot(e.g.between9amand10am)thenumber ofreadsandwritesisknown,althoughtheexacttime ofeachaccessisnotknown.inaprobabilisticaccess pattern,expectednumberofreadsandandtheexpectednumberofwritesineachtimeslotareknown. Thecustomerand/ortheinformation-providerdene theaccesspattern,andinputittoanalgorithmthat selectstheoptimalretrievalprotocolforeachslot. Currently,wearebuildingasystemcalledWireless- View,tobeinstalledinmobilecomputersthataccess onlineservices.itreceivesasparameterstheexpected accesspatternandthecostmodel,andselectsaretrievalprotocolthatoptimizestheoverallcost.inthis paperwedescribehowthesystemmakesthisselection forthecostmodels,accesspatterns,andretrievalprotocolsdiscussedabove.somecombinationsof(costmodel,access-pattern-model,retrieval-protocol)have astraight-forwardformulaforcomputingthetotal cost,othersaremorechallenging.forexample,the (linear-time)allocationalgorithmforpartiallydeterministicpatternsinthetimebasedaccess-costmodel wasdiculttodevise,particularlyifthepatternis periodicand/orestimated(i.e.thenumberofreads (writes)inthenexttime-slotisestimatedastheaverageofthenumberofreads(writes)inthelastj slots).thingsarefurthercomplicatedbythefactthat notallprotocolsforcommunication-costoptimization arecompatiblewithprotocolsforaccess-costoptimization. Insummary,themaincontributionsofthispaper areasfollows. Wedemonstratetheapplicationofthedynamic allocationprincipleforcostoptimizationinaccessingonlineservices. Weintroduceanarchitectureforonlinedatabase
servicesinaconsumer-orientedenvironment. Weoutlineseveralcostmodelsandfactorsaectingthesecosts. Wepresentecientalgorithmsforoptimizing thesecostsforvariousaccesspatternsandretrievalprotocols. Nowwediscussrelevantwork.Inapreviouspaper ([7]),wehavealsodiscussedoptimalretrievalprotocols,butthatworkwasrestrictedtoaparticularscenariopresentedhere,namelyoptimizationofcommunicationcostforprobabilisticaccesspatternsinthe requestbasedcostmodel.theworkin[8,9]isalso relevanttothispaperbutthatworkconcentrateson broadcasting,whichisnotacentralthemeofourpaper.thewireless-viewsystemdiscussedabovewas conceivedin[6]. Therestofthepaperisorganizedasfollows.Section2discussesthearchitectureofatypicalconsumerorientedonline-servicesenvironment.InSections3 and4wediscussalgorithmsforaccesscostoptimization.section3concentratesonthetimebasedcost model,andsection4concentratesontherequest basedcostmodel.section5,discussescommunicationcostoptimizationbetweentheserveragentand theserver. 2Architecture Theenvironmentconsistsofthreeindependentfunctionalentities,thedatabasepublisher,thenetwork provider,andthecustomers.thedatabasepublisher providesservicestowidegeographicareas,e.g.,the wholeus.thecustomersusemobile/portablecomputers,thusthesystemconsistsofasetmcofactive mobilecomputersandaserverstationarycomputer SCthatstorestheonlinedatabase.Weassumethat eachmobilecomputerinthesetmcisconnectedto SC,i.e.,itcansendandreceivemessagesfromtheSC. TheMCsetvariesovertimesincemobilecomputers candisconnect,turn-onando.althoughwereferto thecomputersinthesetmcasmobilecomputers, someofthemmaybeinaxedlocation,connected bywirelinestothexednetwork.whatmattersfor thepurposeofthispaperisthatthecomputersinthe setmcaccessonlinedatabasesanddigitallibraries usingthearchitectureoutlinedinthissection. Eachcustomerpaysaccesschargestothedatabase publisher,andthedatabasepublisherpaysthenetworkproviderforthecommunication.alternatively, thecustomermaypaycommunicationchargesdirectly tothenetworkprovider.insomecasestheaccess chargeiszero.forexample,iftheuserisasalesperson thataccessestheinventoryinformationinthecorporatedatabase,accesschargewillprobablybezero. Weconsiderretrievalandupdateofadatabase view,x.herexisdenedbyapredicate,anditmay containoneormoredataitems,oritmayconstitute thewholedatabase.forexample,xmaybetheibm stockprice,orthepriceofsomecollectionofstocks, oritmaybethesetofrecordsofaaightsoutof Chicagoon12/12/93,ormailboxoftheuserinthe servercomputer.inthelattercase,awriteistheadditionofamessagetothemailbox,andareadretrieves theunreadmessages. Weareconcernedwithreadsthatareissuedatthe mobilecomputersandwritesthatareissuedatthe servercomputer.thesearetherelevantrequests. TheuserretrievesinformationfromtheviewxeitherbySubscription,oron-Demand.ASubscription requeststhatallupdatestoxbetransmittedtothe user'smobilecomputer.wealsodiscussthecaseof selectivesubscriptions,wheretheupdateistransmittedonlywhensomethresholdisexceeded(e.g.the priceofthestockexceeds15,ortheviewinthemobilecomputerismorethan10minutesold). Inordertoaccessthedatabaseauserhastoinstall inhis/hermobilecomputerasoftwaremoduleprovidedbythedatabasepublisher.thissoftwaremoduleiscalledtheserveragent(sa);itprocessesthe requestsoftheclientagent(ca),i.e.theuseror his/hersoftware.thecareceivesdatabaseinformationfromthesa,andinturn,thesareceivesinformationfromtheserver. ThisarchitectureillustratedinFigure1. TheSAprovidestotheCAthefollowingservices foreachviewx. subscribe:unsolicitedly,transfertothecaeach updateofx,or,inthecaseofdivergencecaching, selectiveupdates.thetransferisreceivedand processedbythecawhiletheusermaybeusinghis/herconsumercomputerforvariousother purposes. cancelsubscription:thecaindicatestothesa
The Architecture Mobile Computer Mobile Computer Client Agent Figure1:Architecture Server Agent Server invalidate:thesaindicatestothecathatthere read:transfertothecathecurrentcontentsof withperformingotherfunctions. thattheclientdoesnotwaitforx,butproceeds x.thisrequestmaybeasynchronousinthesense theviewx. thatthecaisnottoreceivefurtherupdatesto Mobile Computer Mobile Computer els.therst,denotedacm1,isrequest-basedinthe accesscost.wewillconsidertwoaccess-costmod- AccessCost TheinteractionbetweentheSAandtheCAincurs wasanupdateofthex,withoutprovidingthenew followingsense.iftheuserhasasubscriptiontoreceivealltheupdatestox,then,foreachtransferofzero.thisisthecostmodelfortelephone(unlimited numberoflocalcalls)orcabletvservice.inthiscost contents. ablestheusertoreceiveallwritestotheviewforaat feepertimeunit(sayaday).inotherwords,the time-basedinthefollowingsense.asubscriptionen- costpertimeunitisxed,regardlessofthenumber isthecostmodelofnewspapersandmagazines,where thecostpercopyishigheratthenews-standthanfor subscription-delivery. ofwritespropagatedtotheuser.thereisalsoasubscriptioninitiationfee,if,whichisgreaterorequalto Thesecondaccesscostmodel,denotedACM2,is informationfromthedatabasetotheuser,theuser subscriptionrequestsdonotincuranaccesscost.this aquerytoreceivethecurrentcopyofx,thenthe notedsac.ontheotherhand,iftheusersubmits dacsac.weassumethattheinvalidateandcancel- costoftheserviceisdac(demand-access-cost),where ischargedasubscription-access-cost.thiscostisde-modeltheusercanalsosubmitaquerytoreceivethe currentcopyofx,ifs/hedoesnothaveasubscription. Thenthecostoftheserviceisdac.Inthiscostmodel theinvalidaterequestisnotbeingused,andthecancelsubscriptionrequestcarriesazeroaccess-cost. broadcastfacilitymaybeusedfortransmittinginval- CommunicationCost theserverandamobilecomputer.forexample,the point-to-pointandbroadcastcommunicationbetween Weassumethatthenetworkproviderenablesboth,
idationmessages,andthepoint-to-pointfacilitymay beusedfordata(thisistheschemeusedin[5]). ThecommunicationbetweentheSAandtheServer incurscommunicationcostasfollows.apointto-pointtransmissionofapage(orless)fromthe ServertotheClientcostscc(chargedbythenetwork provider),andthecostofarequest(toread)sentfrom theclienttotheserveris!.notethat!maybe higherthanccsinceuplinkcommunicationmaybe moreexpensivethandownlinkcommunication.the broadcastofapagefromtheservertoanarbitrary numberofclientscostsb. RetrievalProtocols Wewillconsiderthecostoftwobasicretrievalprotocolsforreadingdatafromtheviewx.Eachone oftheseprotocolscanbeusedforca'sinterfaceto retrievex-datafromthesa,andforsa'sinterfaceto retrievex-datafromtheserver.theobjectiveofeach interfaceistooptimizecost. ThearchitectureinvolvingaccessandcommunicationcostsisdepictedinFigure2. TheRetrievalProtocolsthatweconsiderareDemand,denotedD,andSubscription,denotedS.If thecaretrievesx-datafromthesausingdemand, itmeansthatthecarequeststhecurrentvalueofx foreachreadissuedbytheuser.inotherwords,the CAdoesnotkeepanup-to-datecopyofx.Similarly, ifthesaretrievesx-datafromtheserverusingdemand,itmeansthatthesarequeststhecurrentvalue ofxwheneverneeded. AsafeatureoftheDemandprotocoltheCA(SA) mayrequestcacheinvalidation.thismeansthatthe SA(server)sendsanindicationtotheCA(SA)whenevertheviewxisupdated.Sincethisindicationis cost-free,thefeatureenablestheclienttopayonly forreadsthatareimmediatelyprecededbyawrite. AnotherwaytoimplementCacheinvalidationisto chargetheuseronlyforreadsthatarepresentedwhen thevalueoftheviewxisdierentfromtheonethat existedwhentheimmediatelyprecedingreadwaspresented.thecacheinvalidationfeaturemayormay notbeavailable. IftheCAretrievesx-datafromtheSAusingSubscription,itmeansthattheCArequeststoautomaticallyreceivealltheupdatestotheviewx.Inother words,thecakeepsanup-to-datecopyofx.similarly,ifthesaretrievesx-datafromtheserverusing Subscription,itmeansthattheSArequeststoautomaticallyreceivealltheupdatestotheviewx.The Subscriptionaccessprotocolmaybeparameterizedfor divergence(see[3,4]).specically,thesubscription protocolreceivesaparameterthatenablesaselective transmissionofupdates.forexample,thecamay receiveoneinevery3updatestotheviewx.thiswill beelaborateduponinsection6. AccessPatterns ForagivenRetrievalProtocol,theaccessandcommunicationcostsdependonthecostmodel,which wediscussedabove,andonthetypeofaccesspattern,whichwediscussnext.theusercanprovide access-patterninformationinoneofseveraltypes. Oneisdeterministic,inwhichtheuserspeciesaset oftimestampedrelevantrequests.forexample,the userspeciesthatthereisawriteofxeveryhour onthehour,andreadsat4:05pm,4:30pm,4:50pm and6:05pm.clearly,foreachoneofthecostmodels andforeachprotocolthecostofagivenpatterncan becomputedinastraight-forwardmanner.unfortunately,accesspatterninformationisrarelyavailable inthisform. Asecondtypeofaccesspatternispartiallydeterministic,inwhichtheuserspeciesthenumberofrequestsforeachtimeunit.Forexampletheuserspeciesthatbetween9and10thereare3readsand4 writes,between10and11thereare2readsand5 writes,etc.determinacyisonlypartial,becausethe exacttimeofeachrequestisnotknown. Aspecialcaseofpartialdeterminismiswhenthe numberofrequestsineachtimeunit,insteadofbeing explicitisestimatedasafunctionofthepreviousn timeunits.forexample,thenumberofreadsinany particularhourisisestimatedtobetheaverageofthe numberofreadsineachofthelastvehours. Athirdtypeofaccesspatternisprobabilistic,in whichtheuserspeciestheexpectednumberofrequestsforeachtimeunit.weassumethatthenumbersofreadsandwritesineachtimeunitarerandom variables;weassumethatanypairoftheserandom variablesareindependent.thus,thismodelissimilar tothepartiallydeterministicone,exceptthattheparametersareexpectedintheprobabilisticsense,rather thanexactones.
Optimization Structure speciedforaperiodsuchasaday,aweek,oramonth. Figure2:OptimizationStructure Server Agent communication toeachconsumer(user)inorderfortheconsumerto access cost cost optimization optimization beabletooptimizetheaccesscost,andtheconsumer Client Agent providesthereadpatterntothedatabasepublisher,so Eachoneoftheaboveaccesspatterntypescanbe thatthelattercanoptimizethecommunicationcost. ItcanbespeciedthattheAccessPatternisrepeated eachperiod. Thedatabasepublisherprovidesthewritepatterntouse.Inthesecondsubsection,weconsideresti- matedpartiallydeterministicpatternandprovidean algorithmforaccesscostoptimization.inthethird subsection,weconsiderperiodicpartiallydeterministicpatterns.inthefourthsubsection,weconsiderthe RetrievalProtocolDemandwithCacheinvalidation. foreachslotinthepatternwhichofthetwoprotocols Thus,boththeClientandtheServerknowapriorithe Server Computer Mobile Computer typeofaccesspattern,anditsparameters.obviously, weassumethatthereadandwriteaccesspatternsare compatible,i.e.iftheconsumerprovidesaprobablisticreadpattern,thenthedatabasepublisheralso providesthewritepatterninaprobablisticformat,so thatboth,theconsumerandthedatabasepublisher, 3.1PartiallyDeterministicPattern, canarriveatacommonprobablisticaccesspattern. 3AccessCostOptimizationin WeconsidertheissueofaccesscostoptimizationbetweentheClientAgentandtheServerAgentinthe mobilecomputer.wehavetwocostmodels,three RetrievalprotocolsandavarietyofAccessPatterns. Thuswehaveanumberofpossiblecongurations.In thissectionweconsiderthetimebasedcostmodel thetime-basedcostmodelpredenedtimes,e.g.midnight.thus,wecandivide TimeBasedCostModel theentirepatternintoanumbernoftimeslots. Opt,forselectingtheoptimalretrievalprotocolsfora givenpartiallydeterministicaccesspattern.theobjectiveistooptimizeaccesscostinthetimebasedcost model.itisassumedthatwecansubscribeonlyat Inthissubsectionwepresentanalgorithm,called tiveoftheoptalgorithmistoproduceanallocation patterni.e.assignsubscriptionordemandtoeach Givenapartiallydeterministicpattern,theobjec- anddescribealgorithmsforaccesscostoptimization. timeslotinthepattern.thisdeterminestheretrieval Intherstsubsection,weconsidertheSubscriptionProtocolusedfortheslot.Wewillshowthatforthe anddemandretrievalprotocols,i.e.wedeterminegivenpattern,theallocationpatterngivesthemini- mumtotalaccesscost. inguntilitexaminessucientnumberoffutureslots. Thus,atanypointintheexecutionofthealgorithm, iteitherimmediatelydecidesaretrievalprotocolfor theslot,oritkeepsthedecisionfortheslotpend- theslotsoneafteranother.afterexaminingeachslot, ThealgorithmOptoperatesasfollows.Itexamines
SDDS DecidedSlotscs z} {?++ UndecidedSlots2r3wj5r6wj {z } UnexaminedSlots Figure3:ClassicationOfSlots thesequenceoftimeslotscanbedividedintothree types,(1)thesequenceofdecidedslotswhichoccur inthebeginning,followedby(2)thesequenceofundecidedslots,i.e.slotsthathavebeenexaminedbut forwhichadecisionispending,followedby(3)the sequenceofunexaminedslots.thedecidedslotsare theslotsforwhichsubscriptionordemandprotocol hasbeenassigned.thealgorithmusestwovariables statusandfus(rstundecidedslot).atanytimethe statusvariabledenotestheretrievalprotocolassigned tothelastdecidedslot,whilefusgivestheindex oftherstundecidedslot.thealgorithmalsouses aprecomputedvaluedfiforeachsloti.here,dfiis thedemandfeefortheithslotandiscomputedasthe productofthenumberofreadsintheithslotandthe demandaccesscostforasinglereadrequest.after theterminationofthealgorithm,thearrayvariable decisioncontainsthedecisionsthathavebeentaken foreachoftheslots.figure3showstheclassication ofthedierentslots. Initially,thestatusvariableisassignedDemand. ThealgorithmOptscanstheslotsonebyone,startingfromtherst.Foreachtimesloti,itcomputes (dfi?ff),wheredfiisthedemandfeeoftheithslot asdescribedabove,andffistheatfeepertime unit.assumethatthevalueofthestatusvariable isdemand.ifthedemandfee(dfi)islessthanor equaltoatfee(ff),i.e.(dfi?ff)0,thealgorithmoptallocatesdemandtothecurrent(ith) slot.ifthedemandfeeisgreaterthantheatfee,i.e. (dfi?ff)>0,itmeansthatsubscriptionischeaper thandemand.however,wecannotassignsubscriptionwheneverthisconditionissatised,becausesubscriptionalsoinvolvesthepaymentoftheinitiation fee(if).so,wecheckwhetherthedemandfee(dfi)is greaterthantheatfee(ff)byif,i.e.dfi?ffif. However,iftheconditionisnotsatisedforasingle slot,wecannotassigndemandtothatslot.thisis becausethecumulativesum(cs)of(dfi?ff)forasequenceofconsecutiveslotsmaysatisfythecondition, i.e.p(dfi?ff)if,althoughforeachindividual slotithedierence(dfi?ff)maybepositiveornegative.so,algorithmoptproceedstothenextslotand computesthecumulativesum(cs),p(dfi?ff). Insummary,whenthevalueofthestatusvariable isdemand(i.e.theretrievalprotocolassignedtothe lastdecidedslotisdemand),thedemandprotocol isassignedtoalltheundecidedslots,i.e.fromthe FirstUndecidedSlottothecurrent(ith)slot,whenevercs0.Ifcsif,thenSubscriptionisassigned toalltheundecidedslotsandthestatusvariablebecomessubscription.ifneitheroftheaboveconditions issatised,thealgorithmproceedstothenextslotand computesthecumulativesumandrepeatstheabove operations. IfthestatusisSubscription,itmeansthattheinitiationfeehasbeenpaid,andwecanallocateSubscriptiontoalltheUndecidedslotswheneverthecumulativesum(cs),Pdfi?ff0.Ifthecs<0,itmeans thatdemandischeaperfortheundecidedslots.however,wecannotchoosedemandifjcsj<if,because ifwehavesubscriptioninanunexaminedslot,we wouldbepayingmoreinswitchingbacktosubscription.thusthealgorithmoptchecksifjcsjif, i.e.itchecksifinitiationfeeisrecoverable.ifso,the algorithmchoosesdemandfortheundecidedslots. Insummary,whenthestatusisSubscription,the SubscriptionprotocolisallocatedtoalltheUndecided slotswhenevercs0.ifcs<0andjcsjif,then DemandisassignedtoalltheUndecidedslotsand thestatusbecomesdemand.ifneitheroftheabove conditionsissatised,thealgorithmoptproceedsto thenextslotandcomputesthecsandrepeatsthe aboveoperations. Ifweareunabletoarriveatadecisionbasedonthe cumulativesumandwereachtheendofthepattern, therearetwopossiblecases,cs<0and0<cs<if. Ineithercase,thealgorithmOptchoosesDemandfor alltheundecidedslots.thisisjustiedbecause,if cs<0,demandischeaperandif0<cs<if,it meansthattheinitiationfeeisnotrecoverable. Aformalpresentationofthealgorithmisgivenin theappendix.
3.2EstimatedPartiallyDeterministic Pattern Thissubsectionconsidersestimatedpartiallydeterministicpatternsinwhichthenumberofreads (writes)inthenexttimeslotisestimatedtobethe ooraverageofthenumbersofreads(writes)inthe lastjtimeslots.theallocationalgorithmison-line andatthebeginningofeachtimeslot,itcomputes theestimatedvalueofthenumberofreadsforthe nextoneormoretimeslots,andusestheseestimated valuesforselectingdemandorsubscriptionforthe nexttimeslot. TheOptalgorithmforthepartiallydeterministic patternsgivenintheprevioussectioncanbeadapted totheabovesettingbycombiningitwiththecomputationoftheestimatedvalues,asfollows.atruntime, attheendofeachtimeslot,theestimatednumberof readsforthenexttimeslotiscomputed.then,algorithmoptisusedtocheckifadecisioncanbereached; ifso,weusethecorrespondingselection.otherwise, i.e.iftheslotisundecided,wecomputetheestimated valuesforthetimeslotafterthenext,andrepeatthe aboveprocedureuntiladecisionaboutthenexttime slot(whichisthefirstundecidedslot)canbemade. Itcanbeshownthattheestimatedvalueswilleventuallyconverge,andafterthisthecumulativesum(i.e. thevalueofthevariablecs)ofthealgorithmopt(see section3.1)willmonotonicallyincreaseordecrease; atthattime,wechoosesubscriptionforthenexttime slotifthecumulativesummonotonicallyincreases, otherwisewechoosedemandforthenexttimeslot. Itcanbeshownthattheestimatedvaluesconverge withinciterationswherecisafunctionofjandthe maximumnumberofreadsinanyofthelastjtime slots. Wehaveasimplerandmoreecientmethodfor thecasej=2,butweomitthisdiscussionforspace considerations. 3.3PeriodicPartiallyDeterministic Pattern Anotherspecialcaseofpartialdeterminismisthe casewhentheaccesspatternisperiodic.here,the numbersofreadsandwritesareknownforeachslot inoneperiodofthepattern.thesamepatternrepeats periodically,innitely. DDSSDD 2kDD 1SD Figure4:Non-trivialCase DDD+?k?+?+? {z } UndecidedSlotsk + DDDSSkSSSSSkS Figure5:FUSinthe1stperiod Theallocationpatternobtainedfortherstperiod cannotbedirectlyassignedtoalltheotherperiodsfor thefollowingreason.whenweconsidertwoadjacent periodswemayhavethecaseillustratedinfigure4. There,thesegments1and2areinbetweentwo Subscriptionslots.Itispossiblethatthecumulative sumofallslotsin1and2isgreaterthan?if.ifthis isthecase,thenallslotsin1and2shouldbeallocated Subscription.Forthisreasonwemodifythealgorithm asfollowsandapplytothersttwoperiods.theopt algorithmismodiedsothatifeitheroftheinner Repeatloopsterminatebecausetheendofthesecond periodisreached,thenforalltheundecidedslotsfrom FirstUndecidedSlottotheendofthesecondperiod, theallocationpatternischosenasfollows.ifthefirst UndecidedSlotisintherstperiod,thenwechoose SubscriptionforalloftheUndecidedslots.Thisis illustratedinfigure5.otherwise,i.e.,ifthefirst UndecidedSlotisinthesecondperiod,thenforeach ithslot(ifus)inthesecondperiod,wechoose theallocationpatternofthecorrespondingslotsin therstperiod.thisisillustratedinfigure6. Forallotherperiods,followingthesecondperiod, werepeattheallocationpatternofthesecondperiod. Theaboveallocationmethodcanbeshowntoproduceanoptimalallocationpattern.Theproofofcorrectnessofthismethodisomittedduetolackofspace.
SSDDS j1s kkssddundecidedslots z} { + 2j1+ 2k + SSDSDSSkSSDDSS Figure6:FUSinthe2ndperiod 3.4DemandwithCacheinvalidation InthissubsectionweconsidertheRetrievalProtocols SubscriptionandDemandwithCacheinvalidation. Weassumethatthepatternispartiallydeterministic. Theobjectiveistooptimizeaccesscostinthetime basedcostmodel.intheretrievalprotocoldemandwith-cache-invalidation,theclienthastopayonlyfor thereadsthatareimmediatelyprecededbyawrite, i.e.thecriticalreads.theexpectednumberofcriticalreadsnc,assumingthattherearenrreadsand nwwritesinatimeslotandassumingthattheyare uniformlydistributed,isgivenasfollows. nc=nrnw nr+nw Thentheexpecteddemandfeeforaslotisncdac. Withthisreviseddemandfee,thealgorithmOptcan beappliedverbatimforaccesscostoptimization. Thealgorithmsthatoptimizeaccesscostforthe estimatedandperiodicpatternscanalsobeapplied verbatimusingthesoreviseddemandfee. 4AccessCostOptimization intherequest-basedcost Model Inthissection,weconsiderthecombinations(AccessPattern,RetrievalProtocol)intherequestbased costmodel,andwedevelopalgorithmsforaccesscost optimization. Intherequestbasedcostmodel,whenevertheuser submitsaquerytoreceivethecurrentcopyoftheview x,thenthecostoftheserviceisdemand-access-cost (dac).iftheuserhasasubscriptiontoreceiveall theupdatestox,thenforeachtransferofinformationfromtheservertotheuser,theuserischargeda subscription-access-cost(sac). Firstweconsiderthecaseinwhichthepossible choicesofretrievalprotocolsaresubscriptionanddemand,i.e.thecache-invalidationoptionisunavailable.asbefore,therearethreetypesofaccesspatterns,i.e.deterministic,partiallydeterministicand probabilistic. Foreachtypeofaccesspattern,thealgorithmfor accesscostoptimizationistrivial.foreachtimeslot iweneedtocomparethesubscriptionfeesi=nw sacandthedemandfeedi=nrdac,andassignthe protocolthatincursalowercost. Now,whatexactlyarenrandnwintheaboveformula?Iftheaccesspatternisdeterministic,theClient needstopayonlyforthosereadsthatfollowawrite. Thusnristhenumberofreadsthatimmediatelyfollowawrite,andnwisthetotalnumberofwritesin theslot. Iftheaccesspatternispartiallydeterministic,we aregiventhenumberofreads(nr)andwrites(nw)in everytimeslot. Iftheaccesspatternisprobabilistic,nristheexpectednumberofreadsintimeunit,andnwisthe expectednumberofwritesinunittime.obviously, intheprobabilisticcase,thecostoptimizedistheexpectedcostratherthantheexactone. Nowassumethatthecacheinvalidationoptionis available.asbefore,foreachtypeofaccesspattern wecomparethesubscriptioncost,si=nwsacwith thedemandcost,di=ncdac,andchoosetheprotocolthatgivestheminimalcostforthatslot.theonly dierenceisthatweusenc(ratherthannr).thisis thenumberofcriticalreads,i.e.readsthatimmediatelyfollowawriteintheslot. 5CommunicationCostOptimization InthissectionweconsidertheissueofcommunicationcostoptimizationbetweentheServerandthe ServerAgentinthemobilecomputer.Again,there arethreeretrievalprotocolsthatcouldbeusedbythe ServerAgent,i.e.Subscription(S),Demand(D),and DemandwithCacheinvalidation(DCI). WeassumethattheRetrievalProtocolbetweenthe ClientAgentandtheServerAgent(calledtheAccess Protocol)hasbeenxed.Thereasonisthatthecon-
sumercan,independentlyofthedatabasepublisher, selectaretrievalprotocolforaccesscostoptimization. Thisimposesaconstraintonthepossiblechoicesof RetrievalProtocolsbetweentheServerAgentandthe Server(calledtheCommunicationProtocol).Inorder toseethisconsiderthefollowingcase.lettheretrieval protocolbetweentheserveragentandtheclientbe Subscription.ThenalltheupdateshavetobepropagatedbytheServerAgenttotheClient.Itisclearly evidentthatdemandcannotbeusedastheretrieval ProtocolbetweentheServerAgentandtheServer. Thusinthiscase,theonlyavailableretrievalprotocol betweentheserveragentandtheserverissubscription.thetablebelowgivesthepossiblechoicesof RetrievalProtocolsbetweentheServerAgentandthe Server,foragivenprotocolbetweentheClientAgent andtheserveragent. AccessProtocolCommunicationProtocol Subscription Subscription Demand Subscription Demand Demand Demand DCI DCI DCI DCI Subscription Fortherestofthissectionweassumethataccess patternispartiallydeterministic,butourapproach canbeappliedtoothertypesofaccess-patterns.now weselectforeverymobilecomputerandforeverytime slottheretrievalprotocolthatminimizesthepoint-topoint(ptp)transmissioncost,fromtheavailableprotocolchoices.ifthebroadcastmodeisunavailablethen ourprotocolselectionprocessendshere.thus,assume fortherestofthissectionthatbroadcastisavailable. Wewilldeterminewhetherornotthebroadcastmode canfurtherreducethecostoftheoptimalptpprotocol.asmentionedinsection2,thebroadcast-costof asinglewrite/pageisb,andatthiscostthepagecan besenttoalltheactivemobilecomputers. Assumethatthenumberofmobilecomputersthat areactive,i.e.turnedon,atanypointintimeis knownapriori,andtheaccesspatternofeachoneof themisalsoknown.thisisthecase,forexample, inacompanythathasaxednumberofsalespersons accessingtheinventorydatabase.thenwecompute thefollowinginequalityforeachtimeslot. Bnwk1nwcc+k2 Xi=1nri(cc+!)+k3 Xi=1nci(2cc+!) Intheaboveformulak1isthenumberofmobile computerswithsubscriptionastheoptimalptpretrievalprotocol,andnwisthenumberofwritesin thetimeslot.observethatnwisidenticalintheaccesspatternsofallmobilecomputers,sinceitisthe numberofwritesattheserver,andisindependent ofaparticularmobilecomputer.k2isthenumber ofmobilecomputerswithdemandastheoptimalptp protocol;nriisthenumberofreadsoftheithsuchmobilecomputer.k3isthenumberofmobilecomputers withdemand-with-cache-invalidationastheoptimal ptpprotocol;nciisthenumberofcriticalreads(forthe methodofcomputingthenumberofcriticalreads,see subsection3.4)oftheithsuchmobilecomputer. Iftheaboveinequalityissatised,thenthecostof broadcastingeachwriteislessexpensivethanthetotalcostofusingtheoptimalptpcommunicationprotocolforeachmobilecomputer.theneachsawill usethesubscriptioncommunicationprotocol(which, ascanbeseenfromtheprevioustable,iscompatiblewitheveryaccessprotocol),andthedatawillbe broadcastedduringthistimeslot.otherwise,i.e.if theinequalityisnotsatised,eachmobilecomputer willuseintheslottheoptimalptpprotocolselected intherststage. Now,whetherornotthenumberofactivemobile computersisknownapriori,consideratimeslotin whichsubscription-with-broadcastisnottheoptimal protocol.atruntime,thebroadcastmodecanstillbe usedtoreducecommunicationcost,asfollows.when awriteisreceivedattheserver,thedatabaseserver computesk,thethenumberofmobilecomputersthat haveasubscriptiontoreceivethewriteinaptpmode, or,havetoreceiveaninvalidationptpmessageasaresultofthewrite.thentheserverdetermineswhether thefollowinginequalityissatised. Bkcc ccisthecostofptptransmissionofasinglepage.ifthe aboveinequalityholds,thewriteisbroadcasted.otherwisethewriteand`invalidate'messagesaretransmittedpoint-to-point.
References [1]TomaszImielinskiandB.R.Badrinath.Mobile WirelessComputing:ChallengesinDataManagement.CommunicationsoftheACM,37:(10), Oct.1994 [2]R.Alonso,D.Barbara,andH.Garcia-Molina. Quasi-copies:Ecientdatasharingforinformationretrievalsystems.InProc.ofEDBT'88, LNCS303.SpringerVerlag,1988. [3]R.Alonso,D.Barbara,andH.Garcia-Molina. Datacachingissuesinaninformationretrieval system.acmtrans.databasesyst.,15(3):359{ 384,1990. [4]Y.Huang,R.Sloan,O.Wolfson.Divergence CachinginClient-ServerArchitectures.ProceedingsofthethirdInternationalConference onparallelanddistributedinformationsystems (PDIS),Austin,TX,Sept.1994,pp.131-139. [5]DanielBarbara,TomaszImielinski.Sleepersand Workaholics:CachingStrategiesinMobileEnvironments.ACMSigmod,1994. [6]O.Wolfson.DataAllocationinMobileComputing:AProjectDescription.Proceedingsofthe IEEEWorkshoponAdvancesinParallelandDistributedSystems,Princeton,NJ,Oct.1993,pp. 89-94. [7]Y.Huang,P.Sistla,O.Wolfson.DataReplicationforMobileComputers.Proceedingsofthe ACM-SIGMOD1994,InternationalConference onmanagementofdata,minneapolis,mn,may 1994,pp.13-24. [8]Tzi-ckerChiueh.SchedulingforBroadcast-based FileSystems.MobidataWorkshop,Nov.1994. [9]S.Acharya,R.Alonso,M.Franklin,S.Zdonik. BroadcastDisks:DataManagementForAsymmetricCommunicationEnvironments.ProceedingsoftheACM-SIGMOD1995,International ConferenceonManagementofData. TheAlgorithmOpt fi:=1 last:=n status:=demand whileilast fcs:=0 FUS:=i Ifstatus=Demand frepeat cs:=cs+(dfi?ff) i:=i+1 until((cs0)w(csif)w(i>last)) if(csif) status:=subscription g elsefrepeat cs:=cs+(dfi?ff) i:=i+1 until((cs0)w(cs?if)w(i>last)) if((cs?if)w(i>last)) status:=demand g forj=fusuptoi?1 decision[j]=status g g