Вы находитесь на странице: 1из 10

TwoPhaseCommit Powerof IBMFederationServer

Allcompanyorproductnamesmentionedhereinare trademarksoftheirrespectiveowners.

AWhitePaper
ByArjunSinha

TwoPhaseCommitPowerofIBMFederationServer

Introduction
Thispaperintroducestheefficiency/effectivenessofTwoPhaseCommitofIBMsDB2Federation Server.Itdealson;HowaCommitexecutedonsourcesystemmanagesthetransactiononheterogeneous targetinstanceusingtheFederationServerlayerofIBMDB2.Italsocoversoneusecasetoprovidecloser lookofsame.

TransactionSystemwithDistributedDatabaseArchitecture:
Today'stransactionprocessingincreasinglyrequiressupportfortransactionsthatspananetworkand mayincludemorethanonetargetinstance. WhenwesayTargetInstancethatmeansitisverypossiblewhenUserfiresacommitonone subjectareaandthenitmayhavetoperformoperationonmultiplephysicaldatabasesystems. OLTPsoftwareusesclient/serverprocessingandbrokeringapplicationsoftwarethatallows transactionstorunondifferentcomputerplatformsinanetwork.Andthisalltakecareby Application. Sometime&somewayit'sbigdealforApplicationtomaintainasingletransactionwhichhasto performonmultipletargetinstance(HeterogeneousTargetSystem).

Forsuchkindofscenario,anewconcepthasbeencomeupandwhatwesayis"TWOPHASECOMMIT" approach.Inwhichapplicationjustsubmititsrequesttofederationlayer&furtheritmanagesallsub transactionsandwillprovideproperacknowledgementbacktoapplication.

TwoPhaseCommitPowerofIBMFederationServer

ImplementationStrategy
Beforeapplyingthisconceptonanysystem,thesystemanalysisshouldinvolveidentifyingtheFeasibility Studyfirst.Someoftheimportantpointscanbecoveredasbelow: Ifapplicationisheavilyloadedwithprocessingtohandlenumberofrequestwhilelisting& sendingthemessagestogetproperacknowledgmentfromheterogeneoussystemforanupdateof source. Forexample,anETL(ExtractionTransform&Loading)tool(asApplicationlayer)isdealingwith1 Insert/updateofsourcetabletorefreshonitsheterogeneoustargetinstance. Ifrealtimeaccessofthedifferentsystemisneeded,andthisisalsopossiblewhensizeof distributeddatabasesisverylarge&itisdifficulttomaintainalldatainoneserverarchitecture.

ThenitsgoodpointtolookaheadandimplementthisTwoPhaseCommitadvantageofFederationServer.

NearbyAdvantages:
FederationserverwithTWOPHASECOMMITenabledwillbeabletohandlecommitexecution for: a) WhensystemhasheterogeneousSource&TargetinstanceslikecombinationofXML, RDBMS,FlatFilesorWebService. b) WhenusersareusingBusinessintelligencedashboardwhichextractsdatafrom heterogeneoussource/targetsystems. c) Whenoneofthenodesfailsoutofdifferentsource/targetsystemnodes.Itisvery importanttogetdisasterresponsefromthefailednode.Federationservermanagesthis dataveryconsistentlyusingTwoPhaseCommit. d) Whenextractioninvolvestoomanyextractionrulesandgetsthedeadlocksituation.It managesthisdeadlocksituationalsoveryeffectively.

TwoPhaseCommitPowerofIBMFederationServer

TransactionProcessingwithSimpleCommit
DiagramA
LetusunderstandbelowmentioneddiagramtogetmorecloselytoSimpleCommitofany transactionprocessingsystem. Thisdiagramshowsatransactionprocessingsystemreadingsourcedataforaninsertorupdate, andtryingtorefreshthesameinitscorrespondingtargetinstances. WhereTargetinstanceisheterogeneoussystemofOracle,SQLServer&DB2.

SoApplicationfirescommitforanyinsertorupdateofsource,whichcanbeseenhereasCommit (T)inabovediagram. Furtherithastomanageallinitssubtargetinstance.ThiscanbeseenT1,T2&T3ascommiton eachtargetinstance. Eachtargetinstanceprovidesasuccessorfailureresponsebacktoapplication.

TwoPhaseCommitPowerofIBMFederationServer

SoapplicationwillmanageacompleteTtransactionbasedonthesuccessfulacknowledgmentof T1,T2&T3. Inthisoverallsystem,wecanseeaheavyworkhastoperformbyApplicationlayerasitis managingeachtransactionseparately.

TwoPhaseCommitPowerofIBMFederationServer

DiagramB
NowletsseeadifferentlookofsamescenariobutusingTwoPhaseCommit. Insamewayatransactionsystemhasgotsource&heterogeneoustargetinstance. ApplicationfiresCommitforanyinsertorupdateontarget(submitCommitrequest)at applicationlayertoFederationServer(WhereFederationserverhasgotTwoPhaseCommit Enabled).

Federationservermanagesconsistencyofthesetransactions.Itusesitsinternalwrappers, connections&fewmethodstomakethishappen. LookingtoabovementionedDiagramB,FirstlayerisApplicationlayerwhichsendcommit requesttoFederationServerasT1,FederationserverhandlesthisrequestwithitsTwoPhase Commitoption.

TwoPhaseCommitPowerofIBMFederationServer

SofederationservermanagesallthreeseparatecommitinstanceT1.1,T1.2andT1.3of Oracle,SQLServer&DB2respectively. OnceitgetssuccessorFailureacknowledgmentfromallnodesthatisOracle,SQLServer&DB2, andthenitreturnsthesametoApplicationlayer.Therecouldbeacombinationofstatuslike belowandviceversa. a) Oracle(Success)ANDSQLServer(Success)ANDDB2(Success)=SuccessasCommit acknowledgmenttoApplicationlayer. b) Oracle(Failure)ORSQLServer(Success)ORDB2(Success)=FailureasRollback acknowledgmenttoApplicationlayer.

TwoPhaseCommitPowerofIBMFederationServer

UsedCase(CustomerScenario)
AsofnowwehaveseenconceptualknowledgeofTwoPhaseCommitofFederationServer;nowlets understandsamewithonerealtimeexampleandwithtoolinterface. BelowmentionedtableDiagramshowsanexampleofSourcetablechangestoitstargettable instances. AnapplicationhasgotasourceCustomerDatainFlatFilestructure. Furtherthisdatamanagesin3differenttables,forexampleSubaccountinformationofCustomer. WetookanexampleofaBankCustomer.WhogetshisprimaryaccountasBankaccountbutthisis possiblethatsamecustomerhasmorethan3typesofaccountslikeCreditAccount,Saving Account&Checkingaccount. WetreattheseaccountsasSubAccount1,SubAccount2&SubAccount3forCreditAccount(Oracle), SavingAccount(SQLServer)&Checkingaccount(DB2)respectively.

TwoPhaseCommitPowerofIBMFederationServer

ApplicationtreatsanewrecordasInsertandanychanged/modifiedrecordasUpdate.Sofor eachstatusitperformsanoperationoneachtargetinstancetomaintainthedataconsistency throughoutthesystem. Lookingbacktotheabovementionedtablediagram,CustomerNameAndrew,andhisCityhas beenchangedtoSanJosetoSantaClara.Pleaseseenumber1tofollowsteps. SothisisanupdateforCustomerAndrew,anditshouldbereflectedinhisallsubaccounts,which resideondifferentdatabases. Forallsuchinsert&update,onceitgetsdone.ApplicationsubmitCommitrequesttoFederation Layer.FederationserverlayeracceptthisrequestasTwoPhaseCommitasitrequiresmorethan onedatabaseinstancefortheinsertion/update. Onceitinserts/updatesconsistentlyoneachdatabase,itsendsanacknowledgmenttoapplication asonlyoneCommitresponseirrespectivetothe3differentcommitresponses.Elseonfailureit getsfailureresponsefromtheFederationserver.

TwoPhaseCommitPowerofIBMFederationServer

References
IBMDB2PL/SQLprogramming

Вам также может понравиться