Sie sind auf Seite 1von 8

TheFirstDatabaseLoadBalancer

November2010
Authors: DoronLevAri(doron.levari@scalebase.com) LiranZelkha(liran.zelkha@scalebase.com)

TheFirstDatabaseLoadBalancer

Contents
1 ExecutiveSummary ........................................................................................ 3 2 ScaleBaseDatabaseLoadBalancerArchitecture ............................................... 4 3 HowItWorks ................................................................................................. 5
3.1 3.2 3.3 Scaling..............................................................................................................5 HighAvailability ................................................................................................6 Multitenancy ...................................................................................................6

4 UsageScenarios.............................................................................................. 7
4.1 4.2 4.3 ImproveExistingApplicationHits/SecondRate ....................................................7 HighAvailabilityonPublicClouds........................................................................7 Multitenancy ...................................................................................................7

5 Conclusions .................................................................................................... 8

TheFirstDatabaseLoadBalancer

1 ExecutiveSummary
Databasesarecomplexbeaststhataredifficulttomanage,nearlyimpossibletoscaleand greedyresourceshogs.Relationaldatabaseshaveaterribleimagetoovercome. Despitetheabove,relationaldatabasesarestillwidelyused,asthereisnobetteralternative thatsupportsACID.Simplyput,applicationsneeddatabases,butmaysuffersignificantly fromhavingtousethem. WeatScaleBaseareattunedtotheseissuesandendeavortohelp.OurScaleBaseDatabase LoadBalancersolvestheissuesofdatabaseavailability,scalabilityandmultitenancyacross remotelocations.Inthiswhitepaper,weillustratehowtheScaleBaseLoadBalancerworks, andhowcustomerscanuseit.

TheFirstDatabaseLoadBalancer

2 ScaleBaseDatabaseLoadBalancerArchitecture
TheScaleBaseLoadBalancerperformsloadbalancingbetweenadatabaseapplicationand itsbackenddatabaseinstancesinthesamewayasstandardwebbasedloadbalancers. However,theScaleBaseLoadBalancerisfarmorethanasimpleloadbalancer!ScaleBase partitionsthedatabasedataintomultipleinstances(atechniqueknownassharding)and thendirectsclientsrequeststotherelevantinstances,thusachievingasharednothing databasearchitecture.Inthisarchitecture,eachdatabaseandinstanceisindependent,and thereisnosinglepointoffailureacrossthesystem.Requestresultsareaggregatedandthe clientispresentedwithasingle,unifiedviewoftherequesteddata,thusensuringthatthe numberofconfigureddatabaseinstancesandtheirstatusesaretransparenttothe application.Thisshardingtechniquehasprovenitselfinsomeoftheworldsmostpopular websites.However,untilnow,shardingwastypicallyconsideredtoocomplextoimplement forregulardatabaseapplications. TheScaleBasesolutionservesasbothadatabasefrontendandadatabasemanager,as depictedbelow:

Onthefrontendside,theScaleBaseLoadBalancerservesasadatabaseproxythatmimics thebehaviorofaregulardatabasebysupportingthesamenetworkprotocolasyourexisting server(MySQL,OracleDatabase,MicrosoftSQLServerorIBMDB2). Onthebackendside,theScaleBaseLoadBalanceractsasadatabasemanagertodistribute databetweenmultipledatabaseserversandtoensurethemosteffectiveusageofexisting hardware.Sinceeachdatabasecontainsonlyaportionofthedata,theScaleBaseEngineis responsiblefordirectingSQLcommandstothecorrectdatabaseserver,aggregatingresults fromthedatabaseservers(ifnecessary)andreturningasingleresultsettothecalling application.

TheFirstDatabaseLoadBalancer

3 HowItWorks
3.1 Scaling
TheScaleBaseDatabaseLoadBalancernotonlyroutesrequeststodatabaseservers,butalso managesthedatainthosedatabases. Allinstanceshavethesameschema,buteachinstancehandlesaspecificpartofthedata.All theinstancestogetherprovideacompleteviewofthedatainthedatabase. Considerthefollowing:

Inthefigureabove,theleftsideshowsaregularemployeetable(infact,itisaportionofthe OracledatabasessampleHRschema).Therightsideshowsapossiblesplitofthisdata, performedbytheScaleBaseDatabaseLoadBalancer.Insteadofasingledatabasethathas sevenrecords,therearethreedatabases,eachcontainingtwotothreerecords. Thisapproachcanprovideanenormousperformanceandstabilityboosttorelational databases.RDBMSsperformmuchbetterwhenthedatasetissmaller.Thisistrueforboth writeandreadoperations(checkouttheScaleBaseblogregardingdatabaseisolationlevels toseesomeoftheproblemslarge,busydatabaseshandle). Also,becauserequestsaredividedbetweenseveraldatabases(eachrequestattemptsto read/writedifferentportionsofthedata),thusscalingisimprovedconsiderably. Thistechniqueiscalledsharding.AtScaleBase,wehaveimproveduponthistechniqueso thatitcansupportanySQLcommand,includingjoinoperations,timestampand autonumberingsupportandmuchmore.

TheFirstDatabaseLoadBalancer

3.2 HighAvailability
Forhighavailability,ScaleBaseDatabaseLoadBalancermaintainsafullreplicaofevery databaseinstance.Ifaninstancefails,ScaleBaseDatabaseLoadBalancerautomatically startsusingthereplica,withoutanydatalossorperformancehit. ScaleBaseDatabaseLoadBalancercansupportmultiplereplicas,makingmultiplereplicas justaconfigurationclickaway.Thisisespeciallyusefulforonsitehighavailabilitywith simultaneousDisasterRecovery(DR)sitesupport.

3.3 Multitenancy
BecausetheScaleBaseDatabaseLoadBalancercanworkwithmultipledatabaseinstances,it ispossibletoprovidecustomerswithtruedatabasemultitenancy.Forexample,usingan easytouseconfigurationutility,customerscanensurethatdataisstoredintheappropriate locale.Forexample,dataforEuropeanusersisstoredintheEuropedatacenter,whiledata forUSusersisstoredintheUSdatacenter. Thiscanbeachievedattheconfigurationlevel,anddoesnotrequireanycodechange. Whatsmore,BIutilities,ETLtoolsandothersstillhavefullviewofthedata,asifitwas storedinasingledatabaseonasingledatacenter!

TheFirstDatabaseLoadBalancer

4 UsageScenarios
4.1 ImproveExistingApplicationHits/SecondRate
OneofScaleBasescustomers,amediumsizedprivatelyheldcompany,isusingthe ScaleBaseDatabaseLoadBalancertosignificantlyincreaseitsdatabasescalability. Thiscustomersapplicationreceivedmillionsofhitsperminuteandtheirexistingdatabase architecturewasfailing.Requirementsnecessitatedthatalldatabepersistedforbillingand BIpurposes.Asaresult,thiscustomerdecidedtoavoidrewritingmajorpartsofitscode, andinsteadtouseScaleBase. AttheProofOfConcept(POC),thecustomercopieditstestdatabaseusingScaleBase DatabaseLoadBalancer,andranitsexistingcode.Withoutanycodechange,thecustomer wasabletodoublethenumberofsimultaneoussupportedusers.

4.2 HighAvailabilityonPublicClouds
Acustomerrunningontwodatacentersdecidedtoconsolidateitsapplicationtoasingle datacenter,inordertoachievegreatercostsavings.ThiscustomerwantedtosupportaDR site,anddecidedtoruntheDRsiteonAmazonsEC2. BecausethecustomerwantedtransparenthighavailabilityonitsDRsiteandwasunableto runOracleRAConEC2,thecustomerdecidedtouseScaleBaseDatabaseLoadBalancerfor databasehighavailabilityonthepubliccloud.

4.3 Multitenancy
Acustomerwhodevelopedanonsiteapplicationdecidedtochangeitsbusinessmodelto SaaS.Schemamodificationsweremadetosupportmultiplecustomersrunningonits existinginfrastructure.However,customersneededtobesplitbetweendatabasesfor securityandmanagementreasons. Insteadofrewritingitsdataaccesslayer,thiscustomerchoseScaleBaseDatabaseLoad Balancer,andwasabletomapdifferentcustomerstodifferentdatabaseswithoutcode change.

TheFirstDatabaseLoadBalancer

5 Conclusions
ScaleBasenowworksinbothSaaSmode(inAmazonEC2,andonothercloudplatforms)and onpremisessoftwaremode.TostartusingtheScaleBasesolution,contactusat info@scalebase.com,orvisitourwebsitetogathermoreinformationandparticipateina freetrial.

Das könnte Ihnen auch gefallen