Welcome to MSDN Blogs Sign in | Join | Help

What is MSDTC and why do I need to care about it?

I've been talking for a while about MSDTC and transactions without explaining them. I know many of you reading this blog already know the terms, but some of the developers just entering the enterprise space don't know if they should care or not about these subjects.

MSDTC is an acronym for Microsoft Distributed Transaction Coordinator. As the name says, MSDTC is a Windows service providing transaction infrastructure for distributed systems. In this case, a transaction means a general way of structuring the interactions between autonomous agents in a distributed system. Each transaction is a state transformation with four key properties - the ACID properties: Atomic (all or nothing), Consistent (legal), Isolated (independent of concurrent transactions) and Durable (once it happens, it cannot be abrogated). There are different techniques that implement the ACID properties but the most known one is two-phase commit.

In other words, transaction processing is a software technology that makes distributed computing reliable. You can see a transaction as a unit of work in which a series of operations occur. The transaction (with its ACID properties) is providing protection in the case when one or more of these operations fail at any point in time. By using transactions, you can vastly simplify the error recovery for your system.

The main actors in a transaction are: the transaction manager (MSDTC), the initiator (the application which started the transaction) and the resource managers (the entities that manage data and work). The flow of actions in a simplified form is:

1. The client application (the initiator) begins a transaction by requesting one from the transaction manager;

2. The client app asks the resource managers to do work as part of the same transaction; during this step, the resource managers register with the transaction manager for that transaction ("they enlist");

3. The client app commits the transaction;

4. The transaction manager coordinates with the resource managers to ensure that all succeed to do the requested work or none of the work if done, thus maintaining the ACID properties.

The main transactions standard currently supported by MSDTC is the OLE Transactions (or OleTx). MSDTC is also supporting other standards like XA (or X/Open Distributed Transaction Processing Standard) and TIP (Transaction Internet Protocol). In the future MSDTC will support WS-Coordination, WS-AtomicTransaction, and WS-BusinessActivity.

You can read more about MSDTC at http://msdn.microsoft.com/library/?url=/library/en-us/cossdk/htm/dtc_toplevel_6vjm.asp?frame=true.

If you are developing COM+ or System.EnterpriseServices components and you are using the Transaction service then you are indirectly using MSDTC. The COM+ infrastructure is hiding all the details from you so you can focus on your business needs instead of implementation details. If you need to bypass COM+ and talk directly to MSDTC you can do it using the MSDTC proxy (msdtcprx.dll). For now, to directly access MSDTC from .Net apps you need to use COM Interop. For future apps, please refer to my previous post about .Net and Transactions.

Published Thursday, March 04, 2004 5:52 PM by florinlazar

Comments

# Florin Lazar: What is the MSDTC and Why Should I Care About it?

Thursday, March 04, 2004 11:31 PM by Sam Gentile's Blog

# re: What is MSDTC and why do I need to care about it?

Thursday, March 04, 2004 11:47 PM by Gheorghe Marius
Hey dude...are you from Romania, right ?
Nice post. I have 2 questions :

- the System.Transactions in Longhorn. It's all managed code, right? No more COM interop.
- using this System.Transactions i can use transactions for anything..for instance...let's say i have a web service which calls some business procedure. The BLL modifies a local db, then it calls a singletone remoting objects which modifies another database and after that i finally call yet another web services which modifies yet another database. Can i make this as s single those transactionable operation ?

Cheers and thanks for the info.

# Transactions (not only) in a Web services world

Friday, March 05, 2004 6:10 AM by Christian Weyer: Web Services

# Take Outs for 5 March 2004

Friday, March 05, 2004 11:47 PM by Enjoy Every Sandwich
You've been Taken Out. Thanks for the Good Post!

# re: What is MSDTC and why do I need to care about it?

Thursday, March 25, 2004 11:14 PM by mjjsb
transaction processing is a software technology that makes distributed computing reliable. You can see a transaction as a unit of work in which a series of operations occur. The transaction (with its ACID properties) is providing protection in the case when one or more of these operations fail at any point in time. By using transactions, you can vastly simplify the error recovery for your system.



The main actors in a transaction are: the transaction manager (MSDTC), the initiator (the application which started the transaction) and the resource managers (the entities that manage data and work). The flow of actions in a simplified form is:

1. The client application (the initiator) begins a transaction by requesting one from the transaction manager;

2. The client app asks the resource managers to do work as part of the same transaction; during this step, the resource manages register with the transaction manager for that transaction (“they enlist”);

3. The client app commits the transaction;

4. The transaction manager coordinates with the resource managers to ensure that all succeed to do the requested work or none of the work if done, thus maintaining the ACID properties.



The main transactions standard currently supported by MSDTC is the OLE Transactions (or OleTx). MSDTC is also supporting other standards like XA (or X/Open Distributed Transaction Processing Standard) and TIP (Transaction Internet Protocol). In the future MSDTC will support WS-Coordination, WS-AtomicTransaction, and WS-BusinessActivity.

# re: What is MSDTC and why do I need to care about it?

Thursday, April 08, 2004 5:49 AM by Gé Brander
Hi,

I still do not understand it. I have some problems regarding MSDTC on a cluster of Windows 2003 and SQL 2000. The application that connects to the database is using MSDTC and it is working fine (when I test it with WinRM0820 and DTCPING) from the one node of the cluster to the other node of the cluster, but from a different machine (not a cluster member) it is not working.
It seems to be something with rights on file or registry, but I can not get hold on to it.
What does the MSDTCPRX.DLL do? And where should it be registred?

Thanks in advance

# re: What is MSDTC and why do I need to care about it?

Sunday, April 11, 2004 3:52 AM by Emilio
And what about those firewall pop ups saying "application msdtc.* is trying to act as a server" ??? should I be worried about that?

# re: What is MSDTC and why do I need to care about it?

Wednesday, April 14, 2004 12:20 AM by Florin Lazar
Gheorghe,
Thanks for the nice words. To answer your questions:

1. In most of the cases System.Transactions will use only managed code. In the same time, it is possible that there will be parts in System.Transactions that will use COM Interop (for instance when talking to MSDTC using Oletx protocol). If performance is your concern, than you need to be aware that the price paid for going cross-process or cross-machine or writing to the disk (that happen when Oletx protocol is used) is considerably higher than the usage of COM Interop.

2. We do our best to enable the scenario you are describing. When you put web services into the picture, Indigo will be the one that will smoothly enable the flow of the transaction between web services. Without Indigo, you can still flow transactions between web services but you have to take care of all the work. Also, without Indigo, you will lack the firewall friendliness of WS-Atomic Transactions.

# re: What is MSDTC and why do I need to care about it?

Wednesday, April 14, 2004 12:26 AM by Florin Lazar
Gé Brander,

I recommend that you post your issue, with more details (for instance what action are you trying to do and how it fails, what error do you get?) to http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.platformsdk.complus_mts&lang=en&cr=US .

Msdtcprx.dll is "the interface" you use to talk to MSDTC service to create, enlist, commit or abort transactions. You don't have to register it, it comes with the OS.

# re: What is MSDTC and why do I need to care about it?

Wednesday, April 14, 2004 12:28 AM by Florin Lazar
Emilio,

Msdtc is a "server" by definition. If you don't use distributed transactions you can disable them on XP or W2K3 and those firewall pop-ups should go away.

# re: What is MSDTC and why do I need to care about it?

Tuesday, May 11, 2004 4:05 AM by Sunil
I have the current configuration, two machines in a cluster and MSDTC is running on both the machines but not as a cluster services. I am not able to start the Component Services window on any machine. The following error i am getting ...
?????:error code 8004E00F-com+ was unable to talk to the Microsoft Distributed transaction coordinator
The run-time environment was unable to initialize for transactions required to support transactional components.
Make sure that MS DTC is running.(DtcGetTransactionManagerE): hr = 0x8004d01b)
Please help. Thanks in Advance

# re: What is MSDTC and why do I need to care about it?

Tuesday, May 11, 2004 7:42 PM by Florin Lazar
Sunil,

Standalone MSDTC on a cluster machine is not supported. MSDTC needs to be a cluster resource.

# re: What is MSDTC and why do I need to care about it?

Wednesday, April 20, 2005 1:11 PM by Rama Gudimetla
Hi Florin.. MSDTC looks good, but what about the transaction co-ordination that we can implement within the SQL server (using "begin transaction" and "commit transaction" within the stored procedures, for example). What advantages does MSDTC provide over that?
Thank you..

# re: What is MSDTC and why do I need to care about it?

Wednesday, April 20, 2005 5:02 PM by florinlazar
Rama,

MSDTC is about distributed transactions that span around multiple resource managers that can exist in a local or remote location.

If you are using only one database, and your work is limited to a stored procedure than you probably don't need MSDTC.

With System.Transactions in Whidbey, we are putting in a place a mechanism called promotion that will allow you to use transactions with no "penalty" and to "pay for play" for each additional resource that you add to the transaction. The performance for System.Transaction using only one database that supports "promotable transactions" (Microsoft SQL Server 2005 does) is similar to using ADO.NET one database transaction operations.

# PDC05: Compensating activities

Friday, September 16, 2005 2:43 PM by Esperpento
PDC05
The other day I mentioned some of the issues surrounding the appropriate scenarios for atomic...

# title

Wednesday, February 01, 2006 12:43 PM by Kurt
DTC sucks

# re: What is MSDTC and why do I need to care about it?

Wednesday, February 01, 2006 1:14 PM by florinlazar
To: Kurt
Thanks for your feedback. Would you be able to share why do you think so? We are open to improve MSDTC.

# re: What is MSDTC and why do I need to care about it?

Friday, February 03, 2006 11:03 AM by Sam
I'm setting up a Win2003 cluster with SQL 2005 failover clustering. Microsoft recommends running MSDTC in a separate cluster group with its own name, ip, and disk resources. How large should my physical disk resource be for this MSDTC cluster group?

# re: What is MSDTC and why do I need to care about it?

Saturday, February 04, 2006 1:47 AM by florinlazar
To: Sam
MSDTC will store its log file on the physical disk in the cluster. By default, the size of the log file is 4MB. So, your disk size should be at least your log file size.

# re: What is MSDTC and why do I need to care about it?

Wednesday, February 22, 2006 6:05 PM by Peter Manser
It probably should be installed but not active by default, and set to automatically start when an application requiring it's functionality is installed.

This would reduce overheads and the security concerns of those who don't use it.

# re: What is MSDTC and why do I need to care about it?

Wednesday, February 22, 2006 6:12 PM by florinlazar
To: Peter Manser

On client machines (XP or Vista), the service is not started by default. It will demand-start when an application will try to use transactions.

# re: What is MSDTC and why do I need to care about it?

Friday, March 10, 2006 10:05 AM by Aileen
I am a bit confused. When we setup our MS & SQL Cluster we decided that we didn't need MS DTC. Now we are getting ready to install SP1 and from the docs it sounds like we absolutely need to install and configure this service. Is this true?? Our cluster is ONLY for Failover, not Load Balancing.  Please advise.

# COM+ Transactions in Windows 2003

Thursday, March 16, 2006 12:41 PM by Nizam
I have been facing a problem with my Business (COM) object hosted on Application server(windows 2003) in COM+ with transaction set as required new. The COM internally calls DB objects which have a function to update MS SQL database table(using Stored Proc) on a different machine(Windows 2003 cluster).

Network DTC is enabled on both machines and MSDTC is configured on windows cluster as well.

Fetch and insert work fine only problem with updates.

Some times the update works fine and some times it throws a SQL time out error.
Could anyone help me in troubleshooting this.

Thanks in advance..

# re: What is MSDTC and why do I need to care about it?

Thursday, March 16, 2006 6:43 PM by florinlazar
To: Aileen

Yes, on W2K3 cluster, the MSDTC needs to be a clustered resource if you or any app needs to use it for transactions. MS SQL Server is using MSDTC transactions.

# re: What is MSDTC and why do I need to care about it?

Monday, March 27, 2006 5:17 PM by Kwan
Hi Florin,

Is MSDTC working in Windows 2003 (Web Edition) with SP1?

I write a very simple .NET WebService that calls out a ServicedComponent.
But it throws an exception:

The run-time environment was unable to initialize for transactions required to support transactional components. Make sure that MS-DTC is running. (DtcGetTransactionManagerEx(): hr = 0x80070005)

The whole test and same setup work for Windows 2003 (Standard Edition) with SP1.  So I only have problem for Web Edition.

BTW, there is another post with the same error:
http://groups.google.ca/group/microsoft.public.windows.server.general/browse_thread/thread/13c4404d6c065bb3/9ee468093d69979d?lnk=st&q=rob+livermore+com%2B&rnum=1&hl=en#9ee468093d69979d

I can provide my test program if you are interested.

Thanks.

Kwan

# re: What is MSDTC and why do I need to care about it?

Thursday, May 04, 2006 6:59 AM by Mark Minasi
Hi Florin, Nice writeup, thanks! My question may be out of your scope; if so then just let me know. I'm not a coder, but I'd thought before that MSDTC's job was to make setting up and doing an ACID transaction simple from a coder's point of view. Now I see (I think) that MSDTC's raison d'etre is more than just ACID, and the key word is DISTRIBUTED... in other words, MSDTC's power lies in being able to update many different database servers simultaneously. (Right?) Anyway, us admin guys have been stumbling over MSDTC since 2003 SP1 because domain controllers all complain that they couldn't process a DCPROMO event. I know, there's a workaround -- go to the Security tab, exit it, return and sometimes the problem goes away. But that's not what I'm wondering. Is the reason that Active Directory even cares about MSDTC is that MSDTC has a major role in helping LSASS, Netlogon and the gang keep multiple domain controllers in sync? That'd be odd, as I'm pretty sure that I've disabled MSDTC on DCs in the past without trouble. Basically I'm just looking for some insights on what effect MSDTC has on Active Directory. Thanks!

# Moodyz Bahrain » Blog Archive » ” HTTP/1.1 500 Server Error “

# re: What is MSDTC and why do I need to care about it?

Tuesday, October 03, 2006 8:18 PM by florinlazar

To: Kwan

There is a known issue with SP1 Web Edition for Server 2003.

To workaround the issue, you can run the following commands:

reg add "HKLM\software\microsoft\windows nt\currentversion\cluster server"

reg add "HKLM\software\microsoft\windows nt\currentversion\cluster server" /v ClusterInstallationState /d 1 /t REG_DWORD

# re: What is MSDTC and why do I need to care about it?

Tuesday, October 03, 2006 8:54 PM by florinlazar

To: Mark Minasi

If you are referring to

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=419544&SiteID=1

then the answer is that currently MSDTC has no effect on Active Directory (yet).

The security settings for MSDTC are different depending on the fact that the machine is a DC or not (tigher settings on DC). When a machine is promoted/demoted to/from a DC, the AD is sending a notification to MSDTC. When MSDTC is trying to change its config, it fails due to a permission bug.

# re: What is MSDTC and why do I need to care about it?

Friday, May 30, 2008 3:56 PM by arunr14

Hello

i am a entry level enterprise developer , so please bare with my ignorance. Currently we have a com+ application ( Factelligence  , used widely in the manufacturing industry) . It has certain API's to create inventory etc .  and we will be writing our own libraries to work along side of Factelligence. Am i right to assume that any database calls made by the Factelligence API will go through the MSDTC ? . i am not really concerned about multiple databases but more about reliable transaction control. I appreciate your help.

# re: What is MSDTC and why do I need to care about it?

Friday, May 30, 2008 4:00 PM by florinlazar

To: arunr14

COM+ uses MSDTC

# re: What is MSDTC and why do I need to care about it?

Friday, May 30, 2008 4:16 PM by arunr14

Thank you for your reply. Following up on my previous comment ,Is it possible   to combine the Transaction created by the COM+ application and my custom commands into one before sending it to the database?

# re: What is MSDTC and why do I need to care about it?

Friday, May 30, 2008 5:33 PM by florinlazar

To: arunr14

Yes, you can combine the trasaction that COM+ is using with other transacted work.

I do recommend posting at the Transactions Forum http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=388&SiteID=1

Anonymous comments are disabled
 
Page view tracker