Você está na página 1de 37

Chapter20:DatabaseSystemArchitectures

Version:Oct5,2006
DatabaseSystemConcepts,5thEd.
Silberschatz,KorthandSudarshan Seewww.dbbook.comforconditionsonreuse

Chapter20:DatabaseSystemArchitectures
s CentralizedandClientServerSystems s ServerSystemArchitectures s ParallelSystems s DistributedSystems s NetworkTypes

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

CentralizedSystems
s Runonasinglecomputersystemanddonotinteractwithother

computersystems.

s Generalpurposecomputersystem:onetoafewCPUsandanumber

ofdevicecontrollersthatareconnectedthroughacommonbusthat providesaccesstosharedmemory. unit,singleuser,usuallyhasonlyoneCPUandoneortwohard disks;theOSmaysupportonlyoneuser.

s Singleusersystem(e.g.,personalcomputerorworkstation):desktop

s Multiusersystem:moredisks,morememory,multipleCPUs,anda

multiuserOS.Servealargenumberofuserswhoareconnectedto thesystemvieterminals.Oftencalledserversystems.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ACentralizedComputerSystem

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ClientServerSystems
s Serversystemssatisfyrequestsgeneratedatmclientsystems,whosegeneral

structureisshownbelow:

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ClientServerSystems(Cont.)
s Databasefunctionalitycanbedividedinto:
q

Backend:managesaccessstructures,queryevaluationand optimization,concurrencycontrolandrecovery. Frontend:consistsoftoolssuchasforms,reportwriters,and graphicaluserinterfacefacilities.

s TheinterfacebetweenthefrontendandthebackendisthroughSQLor

throughanapplicationprograminterface.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ClientServerSystems(Cont.)
s Advantagesofreplacingmainframeswithnetworksofworkstationsor

personalcomputersconnectedtobackendservermachines:
q q q q

betterfunctionalityforthecost flexibilityinlocatingresourcesandexpandingfacilities betteruserinterfaces easiermaintenance

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ServerSystemArchitecture
s Serversystemscanbebroadlycategorizedintotwokinds:
q

transactionserverswhicharewidelyusedinrelationaldatabase systems,and dataservers,usedinobjectorienteddatabasesystems

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TransactionServers
s AlsocalledqueryserversystemsorSQLserversystems
q q q

Clientssendrequeststotheserver Transactionsareexecutedattheserver Resultsareshippedbacktotheclient.

s RequestsarespecifiedinSQL,andcommunicatedtotheserver

througharemoteprocedurecall(RPC)mechanism.

s TransactionalRPCallowsmanyRPCcallstoformatransaction. s OpenDatabaseConnectivity(ODBC)isaClanguageapplication

programinterfacestandardfromMicrosoftforconnectingtoaserver, sendingSQLrequests,andreceivingresults.

s JDBCstandardissimilartoODBC,forJava

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TransactionServerProcessStructure
s Atypicaltransactionserverconsistsofmultipleprocessesaccessing

datainsharedmemory.
q

s Serverprocesses

Thesereceiveuserqueries(transactions),executethemandsend resultsback Processesmaybemultithreaded,allowingasingleprocessto executeseveraluserqueriesconcurrently Typicallymultiplemultithreadedserverprocesses Moreonthislater Outputmodifiedbufferblockstodiskscontinually

s Lockmanagerprocess
q

s Databasewriterprocess
q

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TransactionServerProcesses(Cont.)
s Logwriterprocess
q q

Serverprocessessimplyaddlogrecordstologrecordbuffer Logwriterprocessoutputslogrecordstostablestorage. Performsperiodiccheckpoints Monitorsotherprocesses,andtakesrecoveryactionsifanyoftheother processesfail

s Checkpointprocess
q

s Processmonitorprocess
q

E.g.abortinganytransactionsbeingexecutedbyaserverprocess andrestartingit

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TransactionSystemProcesses(Cont.)

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TransactionSystemProcesses(Cont.)
s Sharedmemorycontainsshareddata
q q q q

Bufferpool Locktable Logbuffer Cachedqueryplans(reusedifsamequerysubmittedagain)

s Alldatabaseprocessescanaccesssharedmemory s Toensurethatnotwoprocessesareaccessingthesamedatastructure

atthesametime,databasessystemsimplementmutualexclusion usingeither
q q

Operatingsystemsemaphores Atomicinstructionssuchastestandset

s Toavoidoverheadofinterprocesscommunicationforlock

request/grant,eachdatabaseprocessoperatesdirectlyonthelock table
q

insteadofsendingrequeststolockmanagerprocess

s Lockmanagerprocessstillusedfordeadlockdetection
DatabaseSystemConcepts5thEdition 20.<number> Silberschatz,KorthandSudarshan

DataServers
s UsedinhighspeedLANs,incaseswhere
q q

Theclientsarecomparableinprocessingpowertotheserver Thetaskstobeexecutedarecomputeintensive.

s Dataareshippedtoclientswhereprocessingisperformed,andthen

shippedresultsbacktotheserver.

s Thisarchitecturerequiresfullbackendfunctionalityattheclients. s Usedinmanyobjectorienteddatabasesystems s Issues:


q q q q

PageShippingversusItemShipping Locking DataCaching LockCaching

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

DataServers(Cont.)
s Pageshippingversusitemshipping
q q q

Smallerunitofshippingmoremessages Worthprefetchingrelateditemsalongwithrequesteditem Pageshippingcanbethoughtofasaformofprefetching Overheadofrequestingandgettinglocksfromserverishighdue tomessagedelays Cangrantlocksonrequestedandprefetcheditems;withpage shipping,transactionisgrantedlockonwholepage. LocksonaprefetcheditemcanbeP{calledback}bytheserver, andreturnedbyclienttransactioniftheprefetcheditemhasnot beenused. Locksonthepagecanbedeescalatedtolocksonitemsinthe pagewhentherearelockconflicts.Locksonunuseditemscan thenbereturnedtoserver.

s Locking
q q q

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

DataServers(Cont.)
s DataCaching
q q q

Datacanbecachedatclienteveninbetweentransactions Butcheckthatdataisuptodatebeforeitisused(cachecoherency) Checkcanbedonewhenrequestinglockondataitem Lockscanberetainedbyclientsystemeveninbetweentransactions Transactionscanacquirecachedlockslocally,withoutcontacting server Servercallsbacklocksfromclientswhenitreceivesconflictinglock request.Clientreturnslockoncenolocaltransactionisusingit. Similartodeescalation,butacrosstransactions.

s LockCaching
q q

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ParallelSystems
s Paralleldatabasesystemsconsistofmultipleprocessorsandmultiple

disksconnectedbyafastinterconnectionnetwork. powerfulprocessors

s Acoarsegrainparallelmachineconsistsofasmallnumberof s Amassivelyparallelorfinegrainparallelmachineutilizes

thousandsofsmallerprocessors.
q

s Twomainperformancemeasures:

throughputthenumberoftasksthatcanbecompletedina giventimeinterval responsetimetheamountoftimeittakestocompleteasingle taskfromthetimeitissubmitted

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

SpeedUpandScaleUp
s Speedup:afixedsizedproblemexecutingonasmallsystemisgiven

toasystemwhichisNtimeslarger.
q

Measuredby:

speedup=smallsystemelapsedtime largesystemelapsedtime
q

SpeedupislinearifequationequalsN. NtimeslargersystemusedtoperformNtimeslargerjob Measuredby:

s Scaleup:increasethesizeofboththeproblemandthesystem
q q

scaleup=smallsystemsmallproblemelapsedtime bigsystembigproblemelapsedtime
q

Scaleupislinearifequationequals1.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

Speedup

Speedup
DatabaseSystemConcepts5thEdition 20.<number> Silberschatz,KorthandSudarshan

Scaleup

Scaleup

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

BatchandTransactionScaleup
s Batchscaleup:
q

Asinglelargejob;typicalofmostdecisionsupportqueriesand scientificsimulation. UseanNtimeslargercomputeronNtimeslargerproblem. Numeroussmallqueriessubmittedbyindependentuserstoa shareddatabase;typicaltransactionprocessingandtimesharing systems. Ntimesasmanyuserssubmittingrequests(hence,Ntimesas manyrequests)toanNtimeslargerdatabase,onanNtimes largercomputer. Wellsuitedtoparallelexecution.

s Transactionscaleup:
q

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

FactorsLimitingSpeedupandScaleup
Speedupandscaleupareoftensublineardueto:
s Startupcosts:Costofstartingupmultipleprocessesmaydominate

computationtime,ifthedegreeofparallelismishigh.

s Interference:Processesaccessingsharedresources(e.g.,system

bus,disks,orlocks)competewitheachother,thusspendingtime waitingonotherprocesses,ratherthanperformingusefulwork. servicetimesofparallelyexecutingtasks.Overallexecutiontime determinedbyslowestofparallelyexecutingtasks.

s Skew:Increasingthedegreeofparallelismincreasesthevariancein

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

InterconnectionNetworkArchitectures
s Bus.Systemcomponentssenddataonandreceivedatafromasingle

communicationbus;
q

Doesnotscalewellwithincreasingparallelism.

s Mesh.Componentsarearrangedasnodesinagrid,andeach

componentisconnectedtoalladjacentcomponents
q q

Communicationlinksgrowwithgrowingnumberofcomponents, andsoscalesbetter. Butmayrequire2nhopstosendmessagetoanode(ornwith wraparoundconnectionsatedgeofgrid).

s Hypercube.Componentsarenumberedinbinary;componentsare

connectedtooneanotheriftheirbinaryrepresentationsdifferin exactlyonebit.
q

ncomponentsareconnectedtolog(n)othercomponentsandcan reacheachotherviaatmostlog(n)links;reducescommunication delays.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

InterconnectionArchitectures

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ParallelDatabaseArchitectures
s Sharedmemoryprocessorsshareacommonmemory s Shareddiskprocessorsshareacommondisk s Sharednothingprocessorsshareneitheracommonmemorynor

commondisk

s Hierarchicalhybridoftheabovearchitectures

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ParallelDatabaseArchitectures

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

SharedMemory
s Processorsanddiskshaveaccesstoacommonmemory,typicallyvia

abusorthroughaninterconnectionnetwork.

s Extremelyefficientcommunicationbetweenprocessorsdatain

sharedmemorycanbeaccessedbyanyprocessorwithouthavingto moveitusingsoftware. sincethebusortheinterconnectionnetworkbecomesabottleneck

s Downsidearchitectureisnotscalablebeyond32or64processors s Widelyusedforlowerdegreesofparallelism(4to8).

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

SharedDisk
s Allprocessorscandirectlyaccessalldisksviaaninterconnection

network,buttheprocessorshaveprivatememories.
q q

Thememorybusisnotabottleneck Architectureprovidesadegreeoffaulttoleranceifaprocessor fails,theotherprocessorscantakeoveritstaskssincethedatabase isresidentondisksthatareaccessiblefromallprocessors.

s Examples:IBMSysplexandDECclusters(nowpartofCompaq)

runningRdb(nowOracleRdb)wereearlycommercialusers subsystem.

s Downside:bottlenecknowoccursatinterconnectiontothedisk s Shareddisksystemscanscaletoasomewhatlargernumberof

processors,butcommunicationbetweenprocessorsisslower.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

SharedNothing
s Nodeconsistsofaprocessor,memory,andoneormoredisks.

Processorsatonenodecommunicatewithanotherprocessorat anothernodeusinganinterconnectionnetwork.Anodefunctionsas theserverforthedataonthediskordisksthenodeowns.

s Examples:Teradata,Tandem,OraclenCUBE s Dataaccessedfromlocaldisks(andlocalmemoryaccesses)donot

passthroughinterconnectionnetwork,therebyminimizingthe interferenceofresourcesharing. processorswithoutinterference.

s Sharednothingmultiprocessorscanbescaleduptothousandsof s Maindrawback:costofcommunicationandnonlocaldiskaccess;

sendingdatainvolvessoftwareinteractionatbothends.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

Hierarchical
s Combinescharacteristicsofsharedmemory,shareddisk,andshared

nothingarchitectures.

s Toplevelisasharednothingarchitecturenodesconnectedbyan

interconnectionnetwork,anddonotsharedisksormemorywitheach other. fewprocessors.

s Eachnodeofthesystemcouldbeasharedmemorysystemwitha s Alternatively,eachnodecouldbeashareddisksystem,andeachof

thesystemssharingasetofdiskscouldbeasharedmemorysystem. virtualmemoryarchitectures
q

s Reducethecomplexityofprogrammingsuchsystemsbydistributed

Alsocallednonuniformmemoryarchitecture(NUMA)

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

DistributedSystems
s Dataspreadovermultiplemachines(alsoreferredtoassitesor

nodes).

s Networkinterconnectsthemachines s Datasharedbyusersonmultiplemachines

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

DistributedDatabases
s Homogeneousdistributeddatabases
q q

Samesoftware/schemaonallsites,datamaybepartitioned amongsites Goal:provideaviewofasingledatabase,hidingdetailsof distribution Differentsoftware/schemaondifferentsites Goal:integrateexistingdatabasestoprovideusefulfunctionality Alocaltransactionaccessesdatainthesinglesiteatwhichthe transactionwasinitiated. Aglobaltransactioneitheraccessesdatainasitedifferentfrom theoneatwhichthetransactionwasinitiatedoraccessesdatain severaldifferentsites.

s Heterogeneousdistributeddatabases
q q

s Differentiatebetweenlocalandglobaltransactions
q q

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

TradeoffsinDistributedSystems
s Sharingdatausersatonesiteabletoaccessthedataresidingat

someothersites. storedlocally.

s Autonomyeachsiteisabletoretainadegreeofcontroloverdata s Highersystemavailabilitythroughredundancydatacanbe s Disadvantage:addedcomplexityrequiredtoensureproper

replicatedatremotesites,andsystemcanfunctionevenifasitefails. coordinationamongsites.
q q q

Softwaredevelopmentcost. Greaterpotentialforbugs. Increasedprocessingoverhead.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

ImplementationIssuesforDistributed Databases
s Atomicityneededevenfortransactionsthatupdatedataatmultiplesites s Thetwophasecommitprotocol(2PC)isusedtoensureatomicity
q

Basicidea:eachsiteexecutestransactionuntiljustbeforecommit, andtheleavesfinaldecisiontoacoordinator Eachsitemustfollowdecisionofcoordinator,evenifthereisafailure whilewaitingforcoordinatorsdecision

s 2PCisnotalwaysappropriate:othertransactionmodelsbasedon

persistentmessaging,andworkflows,arealsoused

s Distributedconcurrencycontrol(anddeadlockdetection)required s Dataitemsmaybereplicatedtoimprovedataavailability s DetailsofaboveinChapter22

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

NetworkTypes
s Localareanetworks(LANs)composedofprocessorsthatare

distributedoversmallgeographicalareas,suchasasinglebuildingor afewadjacentbuildings. overalargegeographicalarea.

s Wideareanetworks(WANs)composedofprocessorsdistributed

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

NetworksTypes(Cont.)
s WANswithcontinuousconnection(e.g.theInternet)areneededfor

implementingdistributeddatabasesystems discontinuousconnection:
q q q q

s GroupwareapplicationssuchasLotusnotescanworkonWANswith

Dataisreplicated. Updatesarepropagatedtoreplicasperiodically. Copiesofdatamaybeupdatedindependently. Nonserializableexecutionscanthusresult.Resolutionis applicationdependent.

DatabaseSystemConcepts5thEdition

20.<number>

Silberschatz,KorthandSudarshan

EndofChapter

DatabaseSystemConcepts,5thEd.
Silberschatz,KorthandSudarshan Seewww.dbbook.comforconditionsonreuse

Você também pode gostar