heys eas transaction management m1

Information about heys eas transaction management m1

Published on November 21, 2007

Author: Haggrid

Source: authorstream.com

Content

Transaction Management with EAS:  Transaction Management with EAS William B. Heys Senior Consultant Stop me at any time for questions:  Stop me at any time for questions Agenda:  Agenda Introducing Transactions Client/Server Transaction Management Transaction Management with EAS Component Transaction Properties TransactionServer Object Transaction State Primitives Stateful vs. Stateless Components Component Deactivation Connection Management Transaction Coordinators Component Design for Transaction Management Introducing Transactions:  Introducing Transactions Transactions comprise one or more SQL statements in a logical group or unit of work A unit of work is atomic – it must succeed or fail as a whole Ensures database consistency All databases updated by an application must be left in a consistent state Database transactions provide isolation Changes made by one user are isolated from changes made by other uses running simultaneously Introducing Transactions:  Introducing Transactions Transactions must be designed and managed properly to maximize application concurrency Otherwise, one user updating a database may cause long-duration locks to be placed on large numbers of rows in the database Until update locks are released, other uses are unable to access or update these rows Users may be placed into extended wait periods To increase concurrency Minimize scope and duration of transactions At same time, carefully maintain database consistency Client/Server Transaction Management:  Client/Server Transaction Management In two-tier client/server applications, transaction management is the responsibility of client application A new database transaction is started when application connects to the database Transaction Management is scripted A COMMIT or ROLLBACK issued by the client ends the current transaction and begins a new transaction Database Transactions:  Database Transactions Databases use a combination of logging and row locking to support transactions All changes made to the database are written to a log file Deleted Rows – image of deleted row Changed Rows – image of row before changes New Rows – primary key of the new row Database changes remain in “pending” state until the outcome of the transaction is known Database Transactions:  Database Transactions DBMS places locks on updated rows (or pages) Locks prevent other users or applications from reading or updating a row (or page) while an update is pending to that row (or page) The result is changes made by one user are isolated from changes made by other users But concurrency is reduced, waiting is increased Locks remain until the current transaction is committed or rolled back. Commit/Rollback Processing:  Commit/Rollback Processing When a transaction is committed, its changes are made permanent All changes made by the application since the transaction began are made permanent When a transaction is rolled back, its changes are removed All changes made by the application since the transaction began are reversed – using the log The database is returned to the original state when the transaction was started For both Commit and Rollback All update locks are released The current transaction ends and a new transaction begins Transaction Management in EAS:  Transaction Management in EAS Responsibility shifts from the client application to EAS (Jaguar) Jaguar manages transactions quite differently Deployment-time component property rather than scripting Database updates performed by multiple components can be grouped into the same atomic unit of work EAS components can participate in implicit transactions EAS Transactions are not explicitly controlled using Commit or Rollback requests Component Transaction Properties:  Component Transaction Properties EAS components have a new transaction support property The transaction support property governs how a component participates in EAS transactions – one of the following values Transaction Not Supported Supports Transaction Requires Transaction Requires New Transaction If a component is currently running within an implicit EAS transaction it is a transactional component Component Transaction Properties:  Component Transaction Properties A component can choose not to participate in implicit EAS transactions Transaction Not Supported Non-transactional components can issue Commit and Rollback requests explicitly Not the recommended approach Component Transaction Properties:  Component Transaction Properties Components which only support a transaction may or may not participate in an implicit transaction Supports Transaction If invoked by a transactional component (one currently running within an EAS transaction), this component will participate in the invoking component’s transaction If invoked by a non-transactional component or directly by the client application, this component will not participate in an EAS transaction Component Transaction Properties:  Component Transaction Properties If a component requires a transaction it will always participate in an EAS transaction Requires Transaction If invoked by a transactional component (one currently running within an EAS transaction), this component will participate in the invoking component’s transaction If invoked by a non-transactional component or directly by the client application, this component will create a new EAS transaction Component Transaction Properties:  Component Transaction Properties If a component requires a new transaction it will always create a new EAS transaction Requires New Transaction If invoked by a transactional component (one currently running within an EAS transaction), this component will create a new EAS transaction, separate from the invoking component’s transaction If invoked by a non-transactional component or directly by the client application, this component will create a new EAS transaction TransactionServer Object:  TransactionServer Object Special PowerBuilder service context object You must create a TransactionServer object to be able to use EAS implicit transaction management Declare an instance variable of type TransactionServer Protected TransactionServer its_transaction_server Create the TransactionServer object in the component’s activate event this.GetContextService (“TransactionServer”, & its_transaction_server) Destroy the TransactionServer object in the component’s deactivate event Transaction State Primitives:  Transaction State Primitives Components invoke transaction state primitives to particpate in implicit EAS transactions Each state primitive has a corresponding PowerBuilder function CompleteWork – SetComplete() RollbackWork – SetAbort() ContinueWork – EnableCommit() DisableCommit – DisableCommit() InTransaction – IsInTransaction() IsRollbackOnly – IsTransactionAborted() Transaction State Primitives:  Transaction State Primitives Transaction state primitives serve two purposes Used by EAS components in place of SQL Commit or Rollback requests to vote on the success or failure of the implicit transaction Component can only vote on the outcome of a transaction, it cannot control the outcome At the end of the transaction, if any no vote is received, the transaction is rolled back. If only yes votes are received, the transaction is committed Indicates whether the component should be deactivated at the end of the method or remain bound to the client Transaction State Primitives:  Transaction State Primitives Transaction State Primitives:  Transaction State Primitives InTransaction – Allows a component to determine whether the current method is running in a transaction IsRollbackOnly - Allow a component to determine if the transaction has already been aborted Stateful vs. Stateless Components:  Stateful vs. Stateless Components Stateful components maintain information on behalf of a client - across method invocations Stateful components must therefore remain bound to a client across method invocations While bound to a client, the component cannot be shared with or used by other clients Stateless components are deactivated and unbound from a client following each method call Stateless components are more scaleable because they can be reused more quickly Stateful vs. Stateless Components:  Stateful vs. Stateless Components Stateful components have many disadvantages Longer lifetimes Require more resources Require more instances to be created for a given set of clients Tend to cause an increase in network traffic Retrieve data into a datastore in the component Bring data from the datastore back to the client Applications using stateless components are more scaleable Better able to utilize server clusters Better load balancing Automatic failover at the component or server level Component Deactivation:  Component Deactivation Stateless components can support early deactivation - they are automatically deactivated when a method call returns Early deactivation is only possible if the component is stateless Set the component deployment-time property for automatic demarcation/deactivation to TRUE Stateless components in a transaction are also deactivated after invoking a SetComplete or SetAbort request Component Deactivation:  Component Deactivation Stateful components must tell EAS when they can be deactivated If the stateful component participates in a transaction, the transaction state primitives can be used to cause component deactivation SetComplete or SetAbort If a stateful component must remain bound to a client it uses a different set of state primitives for transaction management EnableCommit or DisableCommit Connection Management:  Connection Management EAS can maintain database connection caches Connection caches (pooling) enable EAS to logically connect and disconnect from the database Performance is improved because the number of actual physical connections and disconnections are reduced Components request connections from the pool or cache If available, a connection will be reused If a connection is not available, a new one will be created and physically connected to the database Connection caching is required for EAS transactions Transaction Coordinators:  Transaction Coordinators EAS supports two transaction coordinators The default transaction coordinator is the SharedConnection coordinator Connection caches are required if you are using the SharedConnection coordinator EAS also supports Microsoft’s Distributed Transaction Coordinator (DTC) DTC supports transactions spanning multiple database connections (2-phase commits) Must use ODBC and a DTC-compliant database (Microsoft SQL Server) Transaction Coordinators:  Transaction Coordinators Jaguar will support additional transaction coordinators in the future Java Transaction Server (JTS) CORBA Object Transaction Server (OTS) Jaguar will also support Transarc Encina’s 2-phase commit processing in the future Component Design:  Component Design Component design may be significantly affected by transaction management needs Consider the example of an ATM The customer wants to perform a single user transaction to transfer money from one account to another The system breaks this into multiple database requests Account balance inquiry Withdraw money from account one Deposit money to account two Write a log record to the audit file Print a receipt If either update fails, both must be rolled back Component Design:  Component Design Application Server Account.getBalances() Select Balance from Savings Select Balance from Checking Component Design:  Component Design Application Server Account.Transfer() Update Savings set balance... Update Checking set balance… Write Log… Print Receipt... Component Design:  Component Design How should we design our components? How many components should we have? What transaction properties should we set? Component Design:  Component Design Customer Component Transaction Required AutoDemarcation TRUE Transaction Management Customer.Withdraw(Savings) Customer.Deposit(Checking) Customer.WriteLog() Transactions 1 2 3 Component Design:  Component Design Customer Component Requires New Transaction AutoDemarcation TRUE Transaction Management Customer.Withdraw(Savings) Customer.Deposit(Checking) Customer.WriteLog() Transactions 1 2 3 Component Design:  Component Design Customer Component Transaction Not Supported AutoDemarcation TRUE Transaction Management Customer.Withdraw(Savings) Customer.Deposit(Checking) Customer.WriteLog() Transactions Component Design:  Component Design Customer Component Transaction Supported AutoDemarcation TRUE Transaction Management Customer.Withdraw(Savings) Customer.Deposit(Checking) Customer.WriteLog() Transactions Component Design:  Component Design Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions 1 2 3 Savings Account Component Transaction Required AutoDemarcation TRUE Checking Account Component Transaction Required AutoDemarcation TRUE Audit Component Component Transaction Required AutoDemarcation TRUE Component Design:  Component Design Savings Account Component Transaction Required AutoDemarcation TRUE Checking Account Component Transaction Required AutoDemarcation TRUE Audit Component Component Transaction Required AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component New Transaction Required or Transaction Required Auto Demarcation TRUE Customer.Transfer() 1 Component Design:  Component Design Savings Account Component Transaction Supported AutoDemarcation TRUE Checking Account Component Transaction Supported AutoDemarcation TRUE Audit Component Component Transaction Supported AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component New Transaction Required or Transaction Required Auto Demarcation TRUE Customer.Transfer() 1 Component Design:  Component Design Savings Account Component Transaction Supported AutoDemarcation TRUE Checking Account Component Transaction Supported AutoDemarcation TRUE Audit Component Component Transaction Supported AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component Transaction Not Supported or Transaction Supported Auto Demarcation TRUE Customer.Transfer() Component Design:  Component Design Savings Account Component NewTrans. Required AutoDemarcation TRUE Checking Account Component New Trans. Required AutoDemarcation TRUE Audit Component Component New Trans. Required AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component New Transaction Required or Transaction Required or Transaction Not Supported or Transaction Supported Auto Demarcation TRUE Customer.Transfer() 1 2 3 Component Design:  Component Design Savings Account Component Trans. Not Supported AutoDemarcation TRUE Checking Account Component Trans. Not Supported AutoDemarcation TRUE Audit Component Component Trans. Not Supported AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component New Transaction Required or Transaction Required or Transaction Not Supported or Transaction Supported Auto Demarcation TRUE Customer.Transfer() Component Design:  Component Design Savings Account Component Transaction Required AutoDemarcation TRUE Checking Account Component Transaction Required AutoDemarcation TRUE Audit Component Component Transaction Required AutoDemarcation TRUE Transaction Management Savings.Withdraw() Checking.Deposit() Audit.WriteLog() Transactions Customer Component Transaction Not Supported or Transaction Supported Auto Demarcation TRUE Customer.Transfer() 1 2 3 About the Speaker:  CPD Professional Certified PowerBuilder Developer Since 1994 Advanced CSI Certified Sybase Instructor (Tools) Since 1992 Founded Boston PowerBuilder User Group in 1992 About the Speaker Special Edition Using PowerBuilder 6:  Special Edition Using PowerBuilder 6 Special Edition Using PowerBuilder 6:  Special Edition Using PowerBuilder 6 ISBN: 0-7897-1437-x Macmillan (Que) website (www.mcp.com) Go to Site Search, Book Information and enter ISBN Amazon.Com (www.amazon.com) Search on author: Heys, William SoftPro Bookstore (www.SoftPro.com) Articles on the Web:  Articles on the Web “Improving Application Performance with the PowerBuilder Trace Engine and Application Profiler” published online in Sybase Powerline magazine “Application Partitioning – Architecting Applications for the Future” published online at PowerCard99, sponsored by Sybase in U.K. Articles in :  Articles in “EASy Does IT: Migrating Applications from Distributed PowerBuilder to Enterprise Application Server 3.0” published in PowerTimes, July-August 1999 “A Brighter future for PowerBuilder and Sybase” Guest editorial published in PowerTimes, July-August 1999 “The New Millennium is Bugging Me, PowerBuilder and the Year 2000 issue” published in PowerTimes, January-February 1999 issue. Books and Articles by Bill Heys:  Books and Articles by Bill Heys Special Edition Using PowerBuilder 5.0. Co-author, published by Que June 1996 “NVO’s How and Why” Posted to Compuserve (Go PBForum) NVO Library Section Filename is NVOHOW.Zip August 1995 PowerBuilder Advisor Columns:  PowerBuilder Advisor Columns “How the PowerBuilder 5.0 Foundation Class Libraries Implement a Service-Based Architecture.” November-December 1996 “New Language Features in PowerBuilder 5.0.” September-October 1996 “Managing your PowerBuilder Objects.” May-June 1996 “Encapsulating Your Objects” March-April 1996 “Introduction to Custom Classes” January-February 1996 (Premier Issue) You can reach me...:  William B. Heys Senior Consultant +1 (781) 203-3171 direct +1 (617) 513-0296 cell bill.heys @ marchFIRST.com bheys @ attglobal.net [email protected] You can reach me... marchFIRST, Inc. 128 Corporate Center 70 Blanchard Rd., 2nd Flooor Burlington, MA 01803 +1 (781) 203-3000 tel +1 (781) 203-3050 fax www.marchFIRST.com

Related presentations


Other presentations created by Haggrid

makyaj
18. 06. 2007
0 views

makyaj

2407224601
22. 04. 2008
0 views

2407224601

0616PVR76491
17. 04. 2008
0 views

0616PVR76491

DART Slideshow
17. 04. 2008
0 views

DART Slideshow

AdvFin 2008 01 Introduction
10. 04. 2008
0 views

AdvFin 2008 01 Introduction

dept revenue presentation
09. 04. 2008
0 views

dept revenue presentation

het607 m06a01
07. 04. 2008
0 views

het607 m06a01

20061116 intl ops
30. 03. 2008
0 views

20061116 intl ops

2004 AMCHAM Doorknock
27. 03. 2008
0 views

2004 AMCHAM Doorknock

pdhpe moderate
18. 06. 2007
0 views

pdhpe moderate

Where the Red Fern Grows
03. 10. 2007
0 views

Where the Red Fern Grows

tutorial 1
19. 09. 2007
0 views

tutorial 1

Future Law Enforcement ppt
19. 09. 2007
0 views

Future Law Enforcement ppt

231B 2006 Suetterlin Lec1
12. 10. 2007
0 views

231B 2006 Suetterlin Lec1

Crocodile
12. 10. 2007
0 views

Crocodile

VLSI Symp 2 10 2007
09. 10. 2007
0 views

VLSI Symp 2 10 2007

2003 08 27 Schelle Wolff Carola
24. 10. 2007
0 views

2003 08 27 Schelle Wolff Carola

875 PERL 06 mini
02. 11. 2007
0 views

875 PERL 06 mini

Where the Sidewalk Ends
26. 10. 2007
0 views

Where the Sidewalk Ends

CNV
22. 10. 2007
0 views

CNV

pfit
07. 11. 2007
0 views

pfit

scholz
16. 11. 2007
0 views

scholz

DDR Frog Licking
17. 11. 2007
0 views

DDR Frog Licking

The Suffering of Jesus
17. 08. 2007
0 views

The Suffering of Jesus

lecture5
28. 11. 2007
0 views

lecture5

ontology
11. 12. 2007
0 views

ontology

predationmurray
01. 01. 2008
0 views

predationmurray

academy mission vision
03. 01. 2008
0 views

academy mission vision

Maldives presentation
07. 08. 2007
0 views

Maldives presentation

mood disorders
07. 08. 2007
0 views

mood disorders

Loh Verma Michalowski CPS04
07. 08. 2007
0 views

Loh Verma Michalowski CPS04

Karen Middleton
07. 08. 2007
0 views

Karen Middleton

Linkage ordinal data hm
07. 08. 2007
0 views

Linkage ordinal data hm

modern Day Slavery
07. 08. 2007
0 views

modern Day Slavery

MOA Presentation Mandsager final
07. 08. 2007
0 views

MOA Presentation Mandsager final

oct15 insurance reinsurance RGA
07. 08. 2007
0 views

oct15 insurance reinsurance RGA

maldives khaleel
07. 08. 2007
0 views

maldives khaleel

peters HTC BlueGene CondorWeek
19. 09. 2007
0 views

peters HTC BlueGene CondorWeek

mostly oopsla03
19. 09. 2007
0 views

mostly oopsla03

2005 Loftus Introduced Fish
19. 11. 2007
0 views

2005 Loftus Introduced Fish

UNTITLED
07. 08. 2007
0 views

UNTITLED

knoblock
23. 10. 2007
0 views

knoblock

India US Dual Use Goldman
17. 08. 2007
0 views

India US Dual Use Goldman

RedSquare Bike Ride Eng
27. 09. 2007
0 views

RedSquare Bike Ride Eng

Financing EFA Maldives
07. 08. 2007
0 views

Financing EFA Maldives

Languages Models Factories
14. 11. 2007
0 views

Languages Models Factories

Ge11cDIfferentiation
20. 02. 2008
0 views

Ge11cDIfferentiation

1950s
24. 02. 2008
0 views

1950s

Dual Language Posterboard 2
24. 02. 2008
0 views

Dual Language Posterboard 2

200792013611855
10. 10. 2007
0 views

200792013611855

as2007 aviation careers brief
28. 02. 2008
0 views

as2007 aviation careers brief

BiodieselFuelQuality pt1
29. 02. 2008
0 views

BiodieselFuelQuality pt1

2005 Inflammation
04. 03. 2008
0 views

2005 Inflammation

MI 2006 final 11 9
07. 08. 2007
0 views

MI 2006 final 11 9

figuerola lucifer
15. 10. 2007
0 views

figuerola lucifer

TOXICVB
05. 01. 2008
0 views

TOXICVB

GENIe ISA
10. 03. 2008
0 views

GENIe ISA

Pretty Blue Planet
19. 09. 2007
0 views

Pretty Blue Planet

AM1 DTV China EN
11. 10. 2007
0 views

AM1 DTV China EN

2007RoyalEurope consumer
01. 11. 2007
0 views

2007RoyalEurope consumer

YTBv4
12. 03. 2008
0 views

YTBv4

SevenBrochure
26. 03. 2008
0 views

SevenBrochure

babar
15. 10. 2007
0 views

babar

memphis
23. 10. 2007
0 views

memphis

NASBE Asthma Policies
07. 08. 2007
0 views

NASBE Asthma Policies

Apache Harmony Short Talk
19. 09. 2007
0 views

Apache Harmony Short Talk

DSF
07. 01. 2008
0 views

DSF

Module 10 C Older Adults
07. 08. 2007
0 views

Module 10 C Older Adults

CEC 999 2006 018
11. 10. 2007
0 views

CEC 999 2006 018

NNER MAGAZIN neu
18. 06. 2007
0 views

NNER MAGAZIN neu

kids slide show
18. 06. 2007
0 views

kids slide show

Inco Present1
18. 06. 2007
0 views

Inco Present1

nifty fifty thrifty 2
18. 06. 2007
0 views

nifty fifty thrifty 2

Navigator
18. 06. 2007
0 views

Navigator

mudancas internas2 lila
18. 06. 2007
0 views

mudancas internas2 lila

MMC Selection271006
18. 06. 2007
0 views

MMC Selection271006

MD Rhythm Software
18. 06. 2007
0 views

MD Rhythm Software

Experian
19. 09. 2007
0 views

Experian

urb1
27. 11. 2007
0 views

urb1

presentation reunion cnds clubs
18. 06. 2007
0 views

presentation reunion cnds clubs

PMA Veri Sign Hot Trends
18. 06. 2007
0 views

PMA Veri Sign Hot Trends

Phys Act2 Ron Johnston
18. 06. 2007
0 views

Phys Act2 Ron Johnston

cdp 8 12 06
19. 09. 2007
0 views

cdp 8 12 06

cdp 12 06
19. 09. 2007
0 views

cdp 12 06

061101 Panofsky
17. 08. 2007
0 views

061101 Panofsky

Saints or Sinners
17. 08. 2007
0 views

Saints or Sinners

memoria
18. 06. 2007
0 views

memoria

00021386
19. 09. 2007
0 views

00021386

peso fall protection w
04. 01. 2008
0 views

peso fall protection w

irony
15. 06. 2007
0 views

irony

HOUSE HOLDER
15. 06. 2007
0 views

HOUSE HOLDER

god you are looking for
15. 06. 2007
0 views

god you are looking for

generadio7
15. 06. 2007
0 views

generadio7

friendship cinquain
15. 06. 2007
0 views

friendship cinquain

foreign words in english
15. 06. 2007
0 views

foreign words in english

FME UC 2006 Opening Session
15. 06. 2007
0 views

FME UC 2006 Opening Session

First fun in the afternoon
15. 06. 2007
0 views

First fun in the afternoon

feml fool 2006
15. 06. 2007
0 views

feml fool 2006

FATE AND CHANCE WEEK I 2006
15. 06. 2007
0 views

FATE AND CHANCE WEEK I 2006

FATE AND CHANCE WEEK 2 2006
15. 06. 2007
0 views

FATE AND CHANCE WEEK 2 2006

faq remarriage
15. 06. 2007
0 views

faq remarriage

faq commitment
15. 06. 2007
0 views

faq commitment

Fabulously Funny Facts
15. 06. 2007
0 views

Fabulously Funny Facts

NEW MEMBERS
18. 06. 2007
0 views

NEW MEMBERS

FOL and Prolog
15. 06. 2007
0 views

FOL and Prolog

mouton
18. 06. 2007
0 views

mouton

NPR
18. 06. 2007
0 views

NPR

NOWARonIran
16. 10. 2007
0 views

NOWARonIran

maendsregler
18. 06. 2007
0 views

maendsregler

Les arts figuratives al s XIX
01. 10. 2007
0 views

Les arts figuratives al s XIX

Kirkpatrick
07. 08. 2007
0 views

Kirkpatrick

texas emission
26. 02. 2008
0 views

texas emission

NFI Pact presentation copy 2
07. 08. 2007
0 views

NFI Pact presentation copy 2

casestudy
22. 10. 2007
0 views

casestudy

Thankyou Lord
17. 08. 2007
0 views

Thankyou Lord

megagreen
18. 06. 2007
0 views

megagreen

SRaha
17. 08. 2007
0 views

SRaha

Glasgow Anand
15. 11. 2007
0 views

Glasgow Anand

2 day training slideshow
07. 08. 2007
0 views

2 day training slideshow

Finch
15. 11. 2007
0 views

Finch