Thursday, September 13, 2007

The Dark Art of Transaction Management

Ask the folks on your team "Who can define transaction management?", expect to see only few hands raised. The number would still dwindle if the question were "What is the transaction strategy used in your application?". This is the reality. Another interesting thing is people treat XA as a panacea. Mind you, it is going to become a resource hog if used improperly.

I came across a recent presentation on InfoQ titled "Transaction Management Strategies in Mission Critical Applications". A good presentation with indepth look at the transaction, its demarcations, management and usage. I highly recommend all the fellow developers/architects to go through the presentation. I particularly liked the myths of transaction management, a quick summary of myths and realties:

Myth1: All mission critical enterprise apps require XA transactions
Myth2: Transaction O/R Mapping integration requires XA/JTA
Myth3: For combining JDBC and JMS access, XA is necessary

The realty is that many enterprise apps do not require XA at all. O/R Mappers just operate on the DB connection with some cache housekeeping that does not require XA. The last myth is the common situation in many applications. I have seen this misconception in a recent project. This can be avoided by using JMS with local transactions or with the acknowledgements.

There is a free book on the InfoQ site - "Java Transaction Design Strategies" by Mark Richards. Use transactions, especially XA with care, otherwise you need to pay the price once application is in production.

No comments: