开发者

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 scen开发者_如何学Ces 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜