user74042
user74042

Reputation: 739

Transaction manager

If I use .Net System.Transactions.TransactionScope class for a transaction across multiple tables in Oracle database, which one will be used LTM[Lightweight transaction manager] or MSDTC[Microsoft distributed transaction coordinator]?

Is there any rule or strategy beind the scenes for deciding which one to use and when? Please advise. Also, wanted to know when is 2-phase commit used?Is it used only incase of distributed transactions across multiple databases?

Thanks.

Upvotes: 0

Views: 1221

Answers (1)

Rich Turner
Rich Turner

Reputation: 10984

The basic rule of thumb is that a transacted resource (e.g. DB, queue, messaging engine, file-system, etc) will select the cheapest and lightest Transaction Coordinator (TC) that its aware of.

MSDTC (or a 3rd party alternative) is only generally invoked when transactions span multiple physical boxes (this requiring a Distributed TC - DTC) or if they span multiple resources, one of whom only understands MSDTC.

For transactions entirely within a particular server app, chances are that they'll use their own internal TC or use the cheapest TC available on the platform they're running on.

Vista/Server2008 introduced the Kernel Transaction Monitor (KTM) which provides a very fast on-box TC. System.Transactions will use KTM if available but if not (e.g. when running on XP/Server2003), will invoke MSDTC.

KTM allows one to, for example, update a DB, some (NTFS) files and an MSMQ queue that all reside on the same physical box without requiring a (more costly) distributed transaction.

Alas, some older software is not aware of KTM and may invoke MSDTC when enlisting in a transaction beyond its local scope.

Upvotes: 2

Related Questions