MTCacheICDE2004

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

-1-MTCache:TransparentMid-TierDatabaseCachinginSQLServerAbstractManyapplicationstodayruninamulti-tierenviron-mentwithbrowser-basedclients,mid-tier(application)serversandabackenddatabaseserver.Mid-tierdatabasecachingattemptstoimprovesystemthroughputandscal-abilitybyoffloadingpartofthedatabaseworkloadtoin-termediatedatabaseserversthatpartiallyreplicatedatafromthebackendserver.Thefactthatsomequeriesareoffloadedtoanintermediateservershouldbecompletelytransparenttoapplications-oneofthekeydistinctionsbetweencachingandreplication.MTCacheisaprototypemid-tierdatabasecachingsolutionforSQLServerthatachievesthistransparency.ItbuildsonSQLServer'ssup-portformaterializedviews,distributedqueriesandrepli-cation.ThispaperdescribesMTCacheandreportsexperimentalresultsontheTPC-Wbenchmark.Theex-perimentsshowthatasignificantpartofthequerywork-loadcanbeoffloadedtocacheservers,resultingingreatlyimprovedscale-outontheread-dominatedworkloadsofthebenchmark.Replicationoverheadwassmallwithanaveragereplicationdelayoflessthantwoseconds.1.IntroductionManyapplicationstodayaredesignedforamulti-tierenvironmenttypicallyconsistingofbrowser-basedclients,mid-tierapplicationserversandabackenddatabaseserver.Applicationserversdonotmaintainpersistentstateandtypicallyrunonfairlyinexpensivemachines.Hence,bot-tlenecksintheapplicationservertiercanbesolvedeasilyandcheaplybyincreasingthenumberofservers.Allpersistentstateismaintainedbythebackenddata-base,whichtypicallyrunsonasinglehigh-endmachine.Auserrequestmaycausetensorevenhundredsofqueriesagainstthebackenddatabase.Theoverallresponsetimeseenbyauserisoftendominatedbytheaggregatequeryresponsetime,particularlywhenthebackendsystemishighlyloaded.Toimproveperformanceandscalability,onemusteitherreducetheloadonthebackendserverorincreaseitscapacity.Thegoalofmid-tierdatabasecach-ingistotransfersomeoftheloadfromthebackenddata-baseservertointermediatedatabaseservers.Aninterme-diateserverhasalocaldatabasestoringacopyofsomeofthedatafromthebackenddatabase,whichallowssomequeriestobecomputedlocally.Akeyrequirementofmid-tierdatabasecachingthatalsodistinguishescachingfromreplicationisthatitmustbetransparenttoapplications.Thatis,addingcachingshouldnotrequireanychangesinapplications.Inparticu-lar,applicationsshouldnotbeawareofwhatiscachedandshouldnotberesponsibleforroutingrequeststothecacheortothebackendserver.Ifapplicationsarerequiredtorouterequeststotheappropriateserver,thecachingstrat-egycannotbechangedwithoutchangingapplications.ThispaperdescribesMTCache[21],amid-tierdata-basecachesolutionforMicrosoftSQLServerthatachievesthisgoal.WedescribeourdesignandprototypeimplementationandreportexperimentalresultsontheTPC-Wbenchmark.MTCacheisbasedonthefollowingapproach.•AshadowdatabaseiscreatedontheMTCacheserverthatcontainsthesametablesasthebackenddatabaseandalsothesameconstraints,indexes,views,permis-sions.Alltablesareemptybutthestatisticsmain-tainedontables,indexesandmaterializedviewsre-flectthedataonthebackendserver.•WhatdatatocacheisdefinedbycreatingmaterializedviewsontheMTCacheserver.Thesematerializedviewsmaybeselectionsandprojectionsoftablesormaterializedviewsonthebackendserver.•ThematerializedviewsontheMTCacheserverarekeptuptodatebySQLServerreplication.Whenaviewiscreated,amatchingreplicationsubscriptionisautomaticallycreatedandtheviewispopulated.•AllqueriesaresubmittedtotheMTCacheserverwhoseoptimizerdecideswhethertocomputeaquerylocally,remotelyorpartlocallyandpartremotely.Optimizationisentirelycostbased.•Allinserts,deletesandupdatesaresubmittedtotheMTCacheserver,whichthentransparentlyforwardsthemtothebackendserver.MTCacheexploitsSQLServer’ssupportformaterial-izedviews,distributedqueriesandtransactionalreplica-tion.Theuseofreplicationisnotinherentinourdesign;othermechanismsforpropagatingupdatesliketwo-phasecommitcouldbeused.Ourapproachresemblestheap-Per-ÅkeLarsonMicrosoftpalarson@microsoft.comJonathanGoldsteinMicrosoftjongold@microsoft.comJingrenZhouColumbiaUniversityjrzhou@cs.columbia.edu-2-proachtakenbyDBCache[2][3][14][20].However,DBCacheappearstobelimitedtocachingofcompletetableswhilewealsoallowcachingofhorizontalandverti-calsubsetsoftablesandmaterializedviews.Inaddition,DBCacheappearstoalwaysusethecachedversionofatablewhenitisreferencedinaquery,regardlessofthecost.InMTCachethisisnotalwaysthecase:thedecisionisdeeplyintegratedintotheoptimizationprocessandisentirelycost-based.Forinstance,ifthereisanindexonthebackendthatgreatlyreducesthecostofthequery;itwillbeexecutedonthebackenddatabase.MTCachealsoincludesimprovedoptimizationofpa-rameterizedqueriesthatresultsinmoreefficientuseofcacheddata.ThisisdonebyproducingdynamicplanswherethedecisionwhethertouseacachedviewismadeatruntimebasedontheactualparametervaluesThisisthefirstimplementationofdynamicplansinanindustrial-strengthdatabasesystem.Dynamicplansarecrucialfortheperformanceofparameterizedqueriesinacachingenvironmentbecausetheyexploitthecacheddataeffi-cientlywhileavoidingtheneedforfrequentreoptimiza-tion.TimesTenalsooffersamid-tiercachingsolutionbuiltontheirin-memorydatabaseman

1 / 12
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功