- 2.85 MB
- 2022-04-29 14:31:52 发布
- 1、本文档共5页,可阅读全部内容。
- 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
- 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
- 文档侵权举报电话:19940600175。
'Chapter17:DatabaseSystemArchitectures
Chapter17:DatabaseSystemArchitecturesCentralizedandClient-ServerSystemsServerSystemArchitecturesParallelSystemsDistributedSystemsNetworkTypes
CentralizedSystemsRunonasinglecomputersystemanddonotinteractwithothercomputersystems.General-purposecomputersystem:onetoafewCPUsandanumberofdevicecontrollersthatareconnectedthroughacommonbusthatprovidesaccesstosharedmemory.Single-usersystem(e.g.,personalcomputerorworkstation):desk-topunit,singleuser,usuallyhasonlyoneCPUandoneortwoharddisks;theOSmaysupportonlyoneuser.Multi-usersystem:moredisks,morememory,multipleCPUs,andamulti-userOS.Servealargenumberofuserswhoareconnectedtothesystemvieterminals.Oftencalledserversystems.
ACentralizedComputerSystem
Client-ServerSystemsServersystemssatisfyrequestsgeneratedatmclientsystems,whosegeneralstructureisshownbelow:
Client-ServerSystems(Cont.)Databasefunctionalitycanbedividedinto:Back-end:managesaccessstructures,queryevaluationandoptimization,concurrencycontrolandrecovery.Front-end:consistsoftoolssuchasforms,report-writers,andgraphicaluserinterfacefacilities.Theinterfacebetweenthefront-endandtheback-endisthroughSQLorthroughanapplicationprograminterface.
Client-ServerSystems(Cont.)Advantagesofreplacingmainframeswithnetworksofworkstationsorpersonalcomputersconnectedtoback-endservermachines:betterfunctionalityforthecostflexibilityinlocatingresourcesandexpandingfacilitiesbetteruserinterfaceseasiermaintenance
ServerSystemArchitectureServersystemscanbebroadlycategorizedintotwokinds:transactionserverswhicharewidelyusedinrelationaldatabasesystems,anddataservers,usedinobject-orienteddatabasesystems
TransactionServersAlsocalledqueryserversystemsorSQLserversystemsClientssendrequeststotheserverTransactionsareexecutedattheserverResultsareshippedbacktotheclient.RequestsarespecifiedinSQL,andcommunicatedtotheserverthrougharemoteprocedurecall(RPC)mechanism.TransactionalRPCallowsmanyRPCcallstoformatransaction.OpenDatabaseConnectivity(ODBC)isaClanguageapplicationprograminterfacestandardfromMicrosoftforconnectingtoaserver,sendingSQLrequests,andreceivingresults.JDBCstandardissimilartoODBC,forJava
TransactionServerProcessStructureAtypicaltransactionserverconsistsofmultipleprocessesaccessingdatainsharedmemory.ServerprocessesThesereceiveuserqueries(transactions),executethemandsendresultsbackProcessesmaybemultithreaded,allowingasingleprocesstoexecuteseveraluserqueriesconcurrentlyTypicallymultiplemultithreadedserverprocessesLockmanagerprocessMoreonthislaterDatabasewriterprocessOutputmodifiedbufferblockstodiskscontinually
TransactionServerProcesses(Cont.)LogwriterprocessServerprocessessimplyaddlogrecordstologrecordbufferLogwriterprocessoutputslogrecordstostablestorage.CheckpointprocessPerformsperiodiccheckpointsProcessmonitorprocessMonitorsotherprocesses,andtakesrecoveryactionsifanyoftheotherprocessesfailE.g.,abortinganytransactionsbeingexecutedbyaserverprocessandrestartingit
TransactionSystemProcesses(Cont.)
TransactionSystemProcesses(Cont.)SharedmemorycontainsshareddataBufferpoolLocktableLogbufferCachedqueryplans(reusedifsamequerysubmittedagain)AlldatabaseprocessescanaccesssharedmemoryToensurethatnotwoprocessesareaccessingthesamedatastructureatthesametime,databasessystemsimplementmutualexclusionusingeitherOperatingsystemsemaphoresAtomicinstructionssuchastest-and-setToavoidoverheadofinterprocesscommunicationforlockrequest/grant,eachdatabaseprocessoperatesdirectlyonthelocktableinsteadofsendingrequeststolockmanagerprocessLockmanagerprocessstillusedfordeadlockdetection
DataServersUsedinhigh-speedLANs,incaseswhereTheclientsarecomparableinprocessingpowertotheserverThetaskstobeexecutedarecomputeintensive.Dataareshippedtoclientswhereprocessingisperformed,andthenshippedresultsbacktotheserver.Thisarchitecturerequiresfullback-endfunctionalityattheclients.Usedinmanyobject-orienteddatabasesystemsIssues:Page-ShippingversusItem-ShippingLockingDataCachingLockCaching
DataServers(Cont.)Page-shippingversusitem-shippingSmallerunitofshippingmoremessagesWorthprefetchingrelateditemsalongwithrequesteditemPageshippingcanbethoughtofasaformofprefetchingLockingOverheadofrequestingandgettinglocksfromserverishighduetomessagedelaysCangrantlocksonrequestedandprefetcheditems;withpageshipping,transactionisgrantedlockonwholepage.LocksonaprefetcheditemcanbeP{calledback}bytheserver,andreturnedbyclienttransactioniftheprefetcheditemhasnotbeenused.Locksonthepagecanbedeescalatedtolocksonitemsinthepagewhentherearelockconflicts.Locksonunuseditemscanthenbereturnedtoserver.
DataServers(Cont.)DataCachingDatacanbecachedatclienteveninbetweentransactionsButcheckthatdataisup-to-datebeforeitisused(cachecoherency)CheckcanbedonewhenrequestinglockondataitemLockCachingLockscanberetainedbyclientsystemeveninbetweentransactionsTransactionscanacquirecachedlockslocally,withoutcontactingserverServercallsbacklocksfromclientswhenitreceivesconflictinglockrequest.Clientreturnslockoncenolocaltransactionisusingit.Similartodeescalation,butacrosstransactions.
ParallelSystemsParalleldatabasesystemsconsistofmultipleprocessorsandmultipledisksconnectedbyafastinterconnectionnetwork.Acoarse-grainparallelmachineconsistsofasmallnumberofpowerfulprocessorsAmassivelyparallelorfinegrainparallelmachineutilizesthousandsofsmallerprocessors.Twomainperformancemeasures:throughput---thenumberoftasksthatcanbecompletedinagiventimeintervalresponsetime---theamountoftimeittakestocompleteasingletaskfromthetimeitissubmitted
Speed-UpandScale-UpSpeedup:afixed-sizedproblemexecutingonasmallsystemisgiventoasystemwhichisN-timeslarger.Measuredby:speedup=smallsystemelapsedtimelargesystemelapsedtimeSpeedupislinearifequationequalsN.Scaleup:increasethesizeofboththeproblemandthesystemN-timeslargersystemusedtoperformN-timeslargerjobMeasuredby:scaleup=smallsystemsmallproblemelapsedtimebigsystembigproblemelapsedtimeScaleupislinearifequationequals1.
Speedup
Scaleup
BatchandTransactionScaleupBatchscaleup:Asinglelargejob;typicalofmostdecisionsupportqueriesandscientificsimulation.UseanN-timeslargercomputeronN-timeslargerproblem.Transactionscaleup:Numeroussmallqueriessubmittedbyindependentuserstoashareddatabase;typicaltransactionprocessingandtimesharingsystems.N-timesasmanyuserssubmittingrequests(hence,N-timesasmanyrequests)toanN-timeslargerdatabase,onanN-timeslargercomputer.Well-suitedtoparallelexecution.
FactorsLimitingSpeedupandScaleupSpeedupandscaleupareoftensublineardueto:Startupcosts:Costofstartingupmultipleprocessesmaydominatecomputationtime,ifthedegreeofparallelismishigh.Interference:Processesaccessingsharedresources(e.g.,systembus,disks,orlocks)competewitheachother,thusspendingtimewaitingonotherprocesses,ratherthanperformingusefulwork.Skew:Increasingthedegreeofparallelismincreasesthevarianceinservicetimesofparallelyexecutingtasks.Overallexecutiontimedeterminedbyslowestofparallelyexecutingtasks.
InterconnectionNetworkArchitecturesBus.Systemcomponentssenddataonandreceivedatafromasinglecommunicationbus;Doesnotscalewellwithincreasingparallelism.Mesh.Componentsarearrangedasnodesinagrid,andeachcomponentisconnectedtoalladjacentcomponentsCommunicationlinksgrowwithgrowingnumberofcomponents,andsoscalesbetter.Butmayrequire2nhopstosendmessagetoanode(ornwithwraparoundconnectionsatedgeofgrid).Hypercube.Componentsarenumberedinbinary;componentsareconnectedtooneanotheriftheirbinaryrepresentationsdifferinexactlyonebit.ncomponentsareconnectedtolog(n)othercomponentsandcanreacheachotherviaatmostlog(n)links;reducescommunicationdelays.
InterconnectionArchitectures
ParallelDatabaseArchitecturesSharedmemory--processorsshareacommonmemoryShareddisk--processorsshareacommondiskSharednothing--processorsshareneitheracommonmemorynorcommondiskHierarchical--hybridoftheabovearchitectures
ParallelDatabaseArchitectures
SharedMemoryProcessorsanddiskshaveaccesstoacommonmemory,typicallyviaabusorthroughaninterconnectionnetwork.Extremelyefficientcommunicationbetweenprocessors—datainsharedmemorycanbeaccessedbyanyprocessorwithouthavingtomoveitusingsoftware.Downside–architectureisnotscalablebeyond32or64processorssincethebusortheinterconnectionnetworkbecomesabottleneckWidelyusedforlowerdegreesofparallelism(4to8).
SharedDiskAllprocessorscandirectlyaccessalldisksviaaninterconnectionnetwork,buttheprocessorshaveprivatememories.ThememorybusisnotabottleneckArchitectureprovidesadegreeoffault-tolerance—ifaprocessorfails,theotherprocessorscantakeoveritstaskssincethedatabaseisresidentondisksthatareaccessiblefromallprocessors.Examples:IBMSysplexandDECclusters(nowpartofCompaq)runningRdb(nowOracleRdb)wereearlycommercialusersDownside:bottlenecknowoccursatinterconnectiontothedisksubsystem.Shared-disksystemscanscaletoasomewhatlargernumberofprocessors,butcommunicationbetweenprocessorsisslower.
SharedNothingNodeconsistsofaprocessor,memory,andoneormoredisks.Processorsatonenodecommunicatewithanotherprocessoratanothernodeusinganinterconnectionnetwork.Anodefunctionsastheserverforthedataonthediskordisksthenodeowns.Examples:Teradata,Tandem,Oracle-nCUBEDataaccessedfromlocaldisks(andlocalmemoryaccesses)donotpassthroughinterconnectionnetwork,therebyminimizingtheinterferenceofresourcesharing.Shared-nothingmultiprocessorscanbescaleduptothousandsofprocessorswithoutinterference.Maindrawback:costofcommunicationandnon-localdiskaccess;sendingdatainvolvessoftwareinteractionatbothends.
HierarchicalCombinescharacteristicsofshared-memory,shared-disk,andshared-nothingarchitectures.Toplevelisashared-nothingarchitecture–nodesconnectedbyaninterconnectionnetwork,anddonotsharedisksormemorywitheachother.Eachnodeofthesystemcouldbeashared-memorysystemwithafewprocessors.Alternatively,eachnodecouldbeashared-disksystem,andeachofthesystemssharingasetofdiskscouldbeashared-memorysystem.Reducethecomplexityofprogrammingsuchsystemsbydistributedvirtual-memoryarchitecturesAlsocallednon-uniformmemoryarchitecture(NUMA)
DistributedSystemsDataspreadovermultiplemachines(alsoreferredtoassitesornodes).NetworkinterconnectsthemachinesDatasharedbyusersonmultiplemachines
DistributedDatabasesHomogeneousdistributeddatabasesSamesoftware/schemaonallsites,datamaybepartitionedamongsitesGoal:provideaviewofasingledatabase,hidingdetailsofdistributionHeterogeneousdistributeddatabasesDifferentsoftware/schemaondifferentsitesGoal:integrateexistingdatabasestoprovideusefulfunctionalityDifferentiatebetweenlocalandglobaltransactionsAlocaltransactionaccessesdatainthesinglesiteatwhichthetransactionwasinitiated.Aglobaltransactioneitheraccessesdatainasitedifferentfromtheoneatwhichthetransactionwasinitiatedoraccessesdatainseveraldifferentsites.
Trade-offsinDistributedSystemsSharingdata–usersatonesiteabletoaccessthedataresidingatsomeothersites.Autonomy–eachsiteisabletoretainadegreeofcontroloverdatastoredlocally.Highersystemavailabilitythroughredundancy—datacanbereplicatedatremotesites,andsystemcanfunctionevenifasitefails.Disadvantage:addedcomplexityrequiredtoensurepropercoordinationamongsites.Softwaredevelopmentcost.Greaterpotentialforbugs.Increasedprocessingoverhead.
ImplementationIssuesforDistributedDatabasesAtomicityneededevenfortransactionsthatupdatedataatmultiplesitesThetwo-phasecommitprotocol(2PC)isusedtoensureatomicityBasicidea:eachsiteexecutestransactionuntiljustbeforecommit,andtheleavesfinaldecisiontoacoordinatorEachsitemustfollowdecisionofcoordinator,evenifthereisafailurewhilewaitingforcoordinatorsdecision2PCisnotalwaysappropriate:othertransactionmodelsbasedonpersistentmessaging,andworkflows,arealsousedDistributedconcurrencycontrol(anddeadlockdetection)requiredDataitemsmaybereplicatedtoimprovedataavailabilityDetailsofaboveinChapter22
NetworkTypesLocal-areanetworks(LANs)–composedofprocessorsthataredistributedoversmallgeographicalareas,suchasasinglebuildingorafewadjacentbuildings.Wide-areanetworks(WANs)–composedofprocessorsdistributedoveralargegeographicalarea.
Local-areaNetwork
NetworksTypes(Cont.)WANswithcontinuousconnection(e.g.,theInternet)areneededforimplementingdistributeddatabasesystemsGroupwareapplicationssuchasLotusnotescanworkonWANswithdiscontinuousconnection:Dataisreplicated.Updatesarepropagatedtoreplicasperiodically.Copiesofdatamaybeupdatedindependently.Non-serializableexecutionscanthusresult.Resolutionisapplicationdependent.
EndofChapter17
Figure17.01
Figure17.02
Figure17.03
Figure17.04
Figure17.05
Figure17.06
Figure17.07
Figure17.08
Figure17.09
Figure17.10
Figure17.11'
您可能关注的文档
- 数据结构课件PPT110章全 第三章 栈和队列1.ppt
- 数据结构课件PPT110章全 第二章.ppt
- 数据结构课件PPT110章全 第十章 内部排序old.ppt
- 数据库系统概念全套配套课件PPT ch13.ppt
- 数据库系统概念全套配套课件PPT ch5.ppt
- 数据库系统概念全套配套课件PPT ch3.ppt
- 数据库系统概念全套配套课件PPT ch1.ppt
- 数据库系统概念全套配套课件PPT ch25.ppt
- 数据库系统概念全套配套课件PPT ch24.ppt
- 数据库系统概念全套配套课件PPT ch20.ppt
- 数据库系统概念全套配套课件PPT ch19.ppt
- 数据库系统概念全套配套课件PPT ch11.ppt
- 数据库系统概念全套配套课件PPT ch14.ppt
- 数据库系统概念全套配套课件PPT ch10.ppt
- 数据库系统概念全套配套课件PPT ch8.ppt
- 数据库系统概念全套配套课件PPT appC.ppt
- 土木工程材料第2版柯国军配套教学课件PPT 03土木工程材料.ppt
- 土木工程材料第2版柯国军配套教学课件PPT 02土木工程材料.ppt