版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第24章高级事务处理Transaction-ProcessingMonitorsTransactionalWorkflowsHigh-PerformanceTransactionSystemsMainmemorydatabasesReal-TimeTransactionSystemsLong-DurationTransactionsTransactionmanagementinmultidatabasesystems1TransactionProcessingMonitorsTPmonitorsinitiallydevelopedasmultithreadedserverstosupportlargenumbersofterminalsfromasingleprocess.Provideinfrastructureforbuildingandadministeringcomplextransactionprocessingsystemswithalargenumberofclientsandmultipleservers.Provideservicessuchas:PresentationfacilitiestosimplifycreatinguserinterfacesPersistentqueuingofclientrequestsandserverresponsesRoutingofclientmessagestoserversCoordinationoftwo-phasecommitwhentransactionsaccessmultipleservers.SomecommercialTPmonitors:CICSfromIBM,PathwayfromTandem,TopEndfromNCR,andEncinafromTransarc2TPMonitorArchitectures3TPMonitorArchitecturesProcessperclientmodel-insteadofindividualloginsessionperterminal,serverprocesscommunicateswiththeterminal,handlesauthentication,andexecutesactions.MemoryrequirementsarehighMultitasking-highCPUoverheadforcontextswitchingbetweenprocessesSingleprocessmodel-allremoteterminalsconnecttoasingleserverprocess.Usedinclient-serverenvironmentsServerprocessismulti-threaded;lowcostforthreadswitchingNoprotectionbetweenapplicationsNotsuitedforparallelordistributeddatabases4TPMonitorArchitecturesMany-serversingle-routermodel-multipleapplicationserverprocessesaccessacommondatabase;clientscommunicatewiththeapplicationthroughasinglecommunicationprocessthatroutesrequests.IndependentserverprocessesformultipleapplicationsMultithreadserverprocessRunonparallelordistributeddatabaseManyservermany-routermodel-multipleprocessescommunicatewithclients.Clientcommunicationprocessesinteractwithrouterprocessesthatroutetheirrequeststotheappropriateserver.Controllerprocessstartsupandsupervisesotherprocesses.5DetailedStructureofaTPMonitor6DetailedStructureofaTPMonitorQueuemanagerhandlesincomingmessagesSomequeuemanagersprovidepersistentordurablemessagequeueingcontentsofqueuearesafeevenifsystemsfails.Durablequeueingofoutgoingmessagesisimportantapplicationserverwritesmessagetodurablequeueaspartofatransactiononcethetransactioncommits,theTPmonitorguaranteesmessageiseventuallydelevered,regardlessofcrashes.ACIDpropertiesarethusprovidedevenformessagessentoutsidethedatabaseManyTPmonitorsprovidelocking,loggingandrecoveryservices,toenableapplicationserverstoimplementACIDpropertiesbythemselves.7ApplicationCoordinationUsingTPMonitorsATPmonitortreatseachsubsystemasaresourcemanagerthatprovidestransactionalaccesstosomesetofresources.TheinterfacebetweentheTPmonitorandtheresourcemanagerisdefinedbyasetoftransactionprimitivesTheresourcemanagerinterfaceisdefinedbytheX/OpenDistributedTransactionProcessingstandard.TPmonitorsystemsprovideatransactionalremoteprocedurecall(transactionalRPC)interfacetotheirserviceTransactionalRPCprovidescallstoencloseaseriesofRPCcallswithinatransaction.UpdatesperformedbyanRPCarecarriedoutwithinthescopeofthetransaction,andcanberolledbackifthereisanyfailure.8WorkflowSystems9Copyright:Silberschatz,KorthandSudarshanTransactionalWorkflowsWorkflowsareactivitiesthatinvolvethecoordinatedexecutionofmultipletasksperformedbydifferentprocessingentities.Withthegrowthofnetworks,andtheexistenceofmultipleautonomousdatabasesystems,workflowsprovideaconvenientwayofcarryingouttasksthatinvolvemultiplesystems.Exampleofaworkflowdeliveryofanemailmessage,whichgoesthroughseveralmailssystemstoreachdestination.Eachmailerperformsatasks:forwardingofthemailtothenextmailer.Ifamailercannotdelivermail,failuremustbehandledsemantically(deliveryfailuremessage).Workflowsusuallyinvolvehumans:e.g.loanprocessing,orpurchaseorderprocessing.10ExamplesofWorkflows11LoanProcessingWorkflowInthepast,workflowswerehandledbycreatingandforwardingpaperformsComputerizedworkflowsaimtoautomatemanyofthetasks.Butthehumansstillplayrolee.g.inapprovingloans.12TransactionalWorkflowsMustaddressfollowingissuestocomputerizeaworkflow.Specificationofworkflows-detailingthetasksthatmustbecarriedoutanddefiningtheexecutionrequirements.Executionofworkflows-executetransactionsspecifiedintheworkflowwhilealsoprovidingtraditionaldatabasesafeguardsrelatedtothecorrectnessofcomputations,dataintegrity,anddurability.E.g.:Loanapplicationshouldnotgetlostevenifsystemfails.Extendtransactionconceptstothecontextofworkflows.Stateofaworkflow-consistsofthecollectionofstatesofitsconstituenttasks,andthestates(i.e.values)ofallvariablesintheexecutionplan.13WorkflowSpecificationStaticspecificationoftaskcoordination:Tasksanddependenciesamongthemaredefinedbeforetheexecutionoftheworkflowstarts.Canestablishpreconditionsforexecutionofeachtask:tasksareexecutedonlywhentheirpreconditionsaresatisfied.Definedpreconditionsthroughdependencies:Executionstatesofothertasks.
“taskticannotstartuntiltasktj
hasended”Outputvaluesofothertasks. “taskticanstartiftasktjreturnsavaluegreaterthan25”Externalvariables,thataremodifiedbyexternalevents.
“tasktimustbestartedwithin24hoursofthecompletionoftasktj”14Workflow
Specification(Cont.)Dynamictaskcoordination
E.g.Electronicmailroutingsysteminwhichthetexttobescheduleforagivenmailmessagedependsonthedestinationaddressandonwhichintermediateroutersarefunctioning.15Failure-AutomicityRequirementsUsualACIDtransactionalrequirementsaretoostrong/unimplementableforworkflowapplications.However,workflowsmustsatisfysomelimitedtransactionalpropertiesthatguaranteeaprocessisnotleftinaninconsistentstate.Acceptableterminationstates-everyexecutionofaworkflowwillterminateinastatethatsatisfiesthefailure-atomicityrequirementsdefinedbythedesigner.Committed-objectivesofaworkflowhavebeenachieved.Aborted-validterminationstateinwhichaworkflowhasfailedtoachieveitsobjectives.Aworkflowmustreachanacceptableterminationstateeveninthepresenceofsystemfailures.16ExecutionofWorkflowsWorkflowmanagementsystemsinclude:Scheduler-programthatprocessworkflowsbysubmittingvarioustasksforexecution,monitoringvariousevents,andevaluationconditionsrelatedtointertaskdependenciesTaskagents-controltheexecutionofataskbyaprocessingentity.Mechanismtoquerytostateoftheworkflowsystem.17WorkflowManagementSystemArchitecturesCentralized-asingleschedulerschedulesthetasksforallconcurrentlyexecutingworkflows.usedinworkflowsystemswherethedataisstoredinacentraldatabase.easiertokeeptrackofthestateofaworkflow.Partiallydistributed-hasone(instanceofa)schedulerforeachworkflow.Fullydistributed-hasnoscheduler,butthetaskagentscoordinatetheirexecutionbycommunicatingwitheachothertosatisfytaskdependenciesandotherworkflowexecutionrequirements.usedinsimplestworkflowexecutionsystemsbasedonelectronicmail18WorkflowSchedulerIdeallyschedulershouldexecuteaworkflowonlyafterensuringthatitwillterminateinanacceptablestate.ConsideraworkflowconsistingoftwotasksS1andS2.Letthefailure-atomicityrequirementbethateitherbothorneitherofthesubtransactionsshouldbecommitted.SupposesystemsexecutingS1andS2donotprovideprepared-to-commitstatesandS1orS2donothavecompensatingtransactions.Itisthenpossibletoreachastatewhereonesubtransactioniscommittedandtheotheraborted.Bothcannotthenbebroughttothesamestate.Workflowspecificationisunsafe,andshouldberejected.Determinationofsafetybytheschedulerisnotpossibleingeneral,andisusuallylefttothedesigneroftheworkflow.19RecoveryofaWorkflowEnsurethatisafailureoccursinanyoftheworkflow-processingcomponents,theworkfloweventuallyreachesanacceptableterminationstate.Failure-recoveryroutinesneedtorestorethestateinformationofthescheduleratthetimeoffailure,includingtheinformationabouttheexecutionstatesofeachtask.Logstatusinformationonstablestorage.Handoffoftasksbetweenagentsshouldoccurexactlyonceinspiteoffailure.Problem:Repeatinghandoffonrecoverymayleadtoduplicateexecutionoftask;notrepeatinghandoffmayleadtotasknotbeingexecuted.Solution:Persistentmessagingsystems20RecoveryofaWorkflow(Cont.)Persistentmessages:messagesarestoredinpermanentmessagequeueandthereforenotlostincaseoffailure.DescribedindetailinChapter19(DistributedDatabases)Beforeanagentcommits,itwritestothepersistentmessagequeuewhatevermessagesneedtobesentout.Thepersistentmessagesystemmustmakesurethemessagesgetdeliveredeventuallyifandonlyifthetransactioncommits.Themessagesystemneedstoresendamessagewhenthesiterecovers,ifthemessageisnotknowntohavereacheditsdestination.Messagesmustbeloggedinstablestorageatthereceivingendtodetectmultiplereceiptsofamessage.21HighPerformance
TransactionSystems22Copyright:Silberschatz,KorthandSudarshanHigh-PerformanceTransactionSystemsHigh-performancehardwareandparallelismhelpimprovetherateoftransactionprocessing,butareinsufficienttoobtainhighperformance:DiskI/Oisabottleneck—I/Otime(10milliseconds)hasnodecreasedataratecomparabletotheincreaseinprocessorspeeds.Paralleltransactionsmayattempttoreadorwritethesamedataitem,resultingindataconflictsthatreduceeffectiveparallelismWecanreducethedegreetowhichadatabasesystemisdiskboundbyincreasingthesizeofthedatabasebuffer.23Main-MemoryDatabaseCommercial64-bitsystemscansupportmainmemoriesoftensofgigabytes.Memoryresidentdataallowsfasterprocessingoftransactions.Disk-relatedlimitations:Loggingisabottleneckwhentransactionrateishigh.Usegroup-committoreducenumberofoutputoperations(Willstudytwoslidesahead.)Iftheupdaterateformodifiedbufferblocksishigh,thediskdata-transferratecouldbecomeabottleneck.Ifthesystemcrashes,allofmainmemoryislost.24Main-MemoryDatabaseOptimizationsToreducespaceoverheads,main-memorydatabasescanusestructureswithpointerscrossingmultiplepages.Indiskdatabases,theI/Ocosttotraversemultiplepageswouldbeexcessivelyhigh.Noneedtopinbufferpagesinmemorybeforedataareaccessed,sincebufferpageswillneverbereplaced.Designquery-processingtechniquestominimizespaceoverhead-avoidexceedingmainmemorylimitsduringqueryevaluation.Improveimplementationofoperationssuchaslockingandlatching,sotheydonotbecomebottlenecks.Optimizerecoveryalgorithms,sincepagesrarelyneedtobewrittenouttomakespaceforotherpages.25GroupCommitIdea:Insteadofperformingoutputoflogrecordstostablestorageassoonasatransactionisreadytocommit,waituntillogbufferblockisfull,oratransactionhasbeenwaitingsufficientlylongafterbeingreadytocommitResultsinfeweroutputoperationspercommittedtransaction,andcorrespondinglyahigherthroughput.However,commitsaredelayeduntilasufficientlylargegroupoftransactionsarereadytocommit,oratransactionhasbeenwaitinglongenough-leadstoslightlyincreasedresponsetime.Abovedelayacceptableinhigh-performancetransactionsystemssincelogbufferblockswillfillupquickly.26Real-TimeTransactionSystemsInsystemswithreal-timeconstraints,correctnessofexecutioninvolvesbothdatabaseconsistencyandthesatisfactionofdeadlines.Harddeadline–SeriousproblemsmayoccuriftaskisnotcompletedwithindeadlineFirmdeadline-Thetaskhaszerovalueifitcompletedafterthedeadline.Softdeadline-Thetaskhasdiminishingvalueifitiscompletedafterthedeadline.Thewidevarianceofexecutiontimesforreadandwriteoperationsondiskscomplicatesthetransactionmanagementproblemfortime-constrainedsystemsmain-memorydatabasesarethusoftenusedWaitsforlocks,transactionaborts,contentionforresourcesremainasproblemsevenifdataisinmainmemoryDesignofareal-timesysteminvolvesensuringthatenoughprocessingpowerexiststomeetdeadlinewithoutrequiringexcessivehardwareresources.27LongDurationTransactionsTraditionalconcurrencycontroltechniquesdonotworkwellwhenuserinteractionisrequired:Longduration:DesigneditsessionsareverylongExposureofuncommitteddata:E.g.,partialupdatetoadesignSubtasks:supportpartialrollbackRecoverability:oncrashstateshouldberestoredevenforyet-to-becommitteddata,souserworkisnotlost.Performance:fastresponsetimeisessentialsousertimeisnotwasted.28Long-DurationTransactionsRepresentasanestedtransactionatomicdatabaseoperations(read/write)atalowestlevel.Iftransactionfails,onlyactiveshort-durationtransactionsabort.Activelong-durationtransactionsresumeonceanyshortdurationtransactionshaverecovered.Theefficientmanagementoflong-durationwaits,andthepossibilityofaborts.Needalternativestowaitsandaborts;alternativetechniquesmustensurecorrectnesswithoutrequiringserializability.29ConcurrencyControlCorrectnesswithoutserializability:Correctnessdependsonthespecificconsistencyconstraintsforthedatabases.Correctnessdependsonthepropertiesofoperationsperformedbyeachtransaction.Usedatabaseconsistencyconstraintsastosplitthedatabaseintosubdatabasesonwhichconcurrencycanbemanagedseparately.Treatsomeoperationsbesidesreadandwriteasfundamentallow-leveloperationsandextendconcurrencycontroltodealwiththem.30ConcurrencyControl(Cont.)Anon-conflict-serializableschedulethatpreservesthesumofA+B31NestedandMultilevelTransactionsAnestedormultileveltransaction
Tisrepresentedbyaset
T={t1,t2,...,tn}ofsubtransactionsandapartialorderPonT.Asubtransaction
tiinTmayabortwithoutforcingTtoabort.Instead,Tmayeitherrestartti,orsimplychoosenottorunti.If
ticommits,thisactiondoesnotmake
ti,permanent(unlikethesituationinChapter15).Instead,ti,commitstoT,andmaystillabort(orrequirecompensation)ifTaborts.AnexecutionofTmustnotviolatethepartialorderP,i.e.,ifanedgeti
ti
appearsintheprecedencegraph,thentiti
mustnotbeinthetransitiveclosureofP.32NestedandMultilevelTransactions(Cont.)Subtransactionscanthemselvesbenested/multileveltransactions.Lowestlevelofnesting:standardreadandwriteoperations.Nestingcancreatehigher-leveloperationsthatmayenhanceconcurrency.Typesofnested/multileveltransactions:Multileveltransaction:subtransactionofTispermittedtoreleaselocksoncompletion.Saga:multilevellong-durationtransaction.Nestedtransaction:locksheldbyasubtransactiontiofTareautomaticallyassigntoToncompletionofti.33ExampleofNestingRewritetransactionT1usingsubtransactionsTaandTbthatperformincrementordecrementoperations:T1consistsofT1,1,whichsubtracts50fromAT1,2,whichadds50toBRewritetransactionT2usingsubtransactionsTcandTdthatperformincrementordecrementoperations:T2consistsofT2,1,whichsubtracts10fromBT2,2,whichadds10toANoorderingisspecifiedonsubtransactions;anyexecutiongeneratesacorrectresult.34CompensatingTransactionsAlternativetoundooperation;compensatingtransactionsdealwiththeproblemofcascadingrollbacks.Insteadofundoingallchangesmadebythefailedtransaction,actionistakento“compensate”forthefailure.Consideralong-durationtransactionTirepresentingatravelreservation,withsubtransactionsTi,1,whichmakesairlinereservations,Ti,2whichreservesrentalcars,andTi,3whichreservesahotelroom.Hotelcancelsthereservation.InsteadofundoingallofTi,thefailureofTi,3iscompensatedforbydeletingtheoldhotelreservationandmakinganewone.Requiresuseofsemanticsofthefailedtransaction.35ImplementationIssuesForlong-durationtransactionstosurvivesystemcrashes,wemustlognotonlychangestothedatabase,butalsochangestointernalsystemdatapertainingtothesetransactions.Loggingofupdatesismademorecomplexbyphysicallylargedataitems(CADdesign,documenttext);undesirabletostorebotholdandnewvalues.Twoapproachestoreducingtheoverheadofensuringtherecoverabilityoflargedataitems:Operationlogging.Onlytheoperationperformedonthedataitemandthedata-itemnamearestoredinthelog.Loggingandshadowpaging.Useloggingfromsmalldataitems;useshadowpagingforlargedataitems.Onlymodifiedpagesneedtobestoredinduplicate.36TransactionManagementinMultidatabaseSystemsTransactionmanagementiscomplicatedinmultidatabasesystemsbecauseoftheassumptionofautonomyGlobal2PL-eachlocalsiteusesastrict2PL(locksarereleasedattheend);lockssetasaresultofaglobaltransactionarereleasedonlywhenthattransactionreachestheend.GuaranteesglobalserializabilityDuetoautonomyrequirements,sitescannotcooperateandexecuteacommonconcurrencycontrolschemeE.g.nowaytoensurethatalldatabasesfollowstrict2PLSolutions:provideverylowlevelofconcurrentexecution,oruseweakerlevelsofconsistency37TransactionManagementLocaltransactionsareexecutedbyeachlocalDBMS,outsideoftheMDBSsystemcontrol.Globaltransactionsareexecutedundermultidatabasecontrol.Localautonomy-localDBMSscannotcommunicatedirectlytosynchronizeglobaltransactionexecutionandthemultidatabasehasnocontroloverlocaltransactionexecution.localconcurrencycontrolschemeneededtoensurethatDBMS’sscheduleisserializableincaseoflocking,DBMSmustbeabletoguardagainstlocaldeadlocks.needadditionalmechanismstoensureglobalserializability38Two-LevelSerializabilityDBMSensureslocalserializabilityamongitslocaltransactions,includingthosethatarepartofaglobaltransaction.Themultidatabaseensuresserializabilityamongglobaltransactionsalone-ignoringtheorderingsinducedbylocaltransactions.2LSRdoesnotensureglobalserializability,however,itcanfulfillrequirementsforstrongcorrectness.1.Preserveconsistencyasspecifiedbyagivensetofconstraints2.GuaranteethatthesetofdataitemsreadbyeachtransactionisconsistentGlobal-readprotocol
:Globaltransactionscanread,butnotupdate,localdataitems;localtransactionsdonothaveaccesstoglobaldata.Therearenoconsistencyconstraintsbetweenlocalandglobaldataitems.39Two-LevelSerializability(Cont.)Local-readprotocol:Localtransactionshavereadaccesstoglobaldata;disallowsallaccesstolocaldatabyglobaltransactions.Atransactionhasavaluedependencyifthevaluethatitwritestoadataitematonesitedependsonavaluethatitreadforadataitemonanothersite.Forstrongcorrectness:Notransactionmayhaveavaluedependency.Global-read-write/local-readprotocol;Localtransactionshavereadaccesstoglobaldata;globaltransactionsmayreadandwritealldata;Noconsistencyconstraintsbetweenlocalandglobaldataitems.Notransactionmayhavevaluedependency.40GlobalSerializabilityEvenifnoinformationisavailableconcerningthestructu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 代理记帐劳动合同(标准版)
- 公司简单物流运输合同模板
- 农场园林转租合同
- 内蒙古师范大学定向协议书
- 苜蓿出售合同模板
- 广东省汕头市友联中学2025届初三中考适应性练习(一)语文试题含解析
- 湖南省益阳市2024-2025学年高二地理上学期期末考试试题含解析
- 广东省汕头市龙湖区2025年高三调研考试(物理试题)试卷含解析
- 2024-2025学年新教材高中数学第十章概率10.3.1频率的稳定性素养检测含解析新人教A版必修第二册
- 辽宁省铁岭市2024年中考生物仿真试题含解析
- 学校教务处巡课表
- 《碳中和碳达峰》双碳学习班会课件全文
- 商业银行精细化管理课件
- 八年级心理健康教案(全册)
- 自然拼读-a-a-e复习讲课资料课件
- 术中知晓业务学习课件
- 形容词比较级最高级中考真题汇编含答案
- 黑龙江省普通高中学生综合素质总结性评价表
- 气焊气割安全操作知识培训课件
- 新版十八项核心制度课件
- 五年级上册英语课件-Lesson1 LiMing's Big Family|冀教版(三起) (共16张PPT)
评论
0/150
提交评论