Response to feedback on my "Developing Distributed Services Today" whitepaper
There's an interesting discussion thread ensuing over on The Server Side about my "Developing Distributed Services Today" whitepaper and I thought I'd take a little time to discuss some of the comments made in that thread.
First, let me just provide clarity on the purpose of the paper.
Ever since PDC 2003, where Joe Long first stood up and presented our early guidance on aligning with indigo, we have been inundated with requests for clear, published guidance on how and when to most appropriately use Microsoft's current distributed systems technologies in order to minimize the amount of code that is impacted by the introduction of Indigo. Customers were not asking how they should use individual features of, for example COM+, they have asked "should we be using COM+ at all?" and "what about .NET Remoting", etc. Despite the fact that I and many others have been providing much of this guidance on our blogs, in newsgroups, at conferences and during briefings with many, many customers here in Redmond and at customer sites all over the world, the message still wasn't getting out there. Internally to Microsoft too, other product groups have been asking the same questions.
In order to deal with the sheer volume of requests, I began writing my blog shortly after PDC 2003 and summarizing our guidance in order to get the word out as broadly as possible. I then began writing the whitepaper giving very, very detailed guidance on what these service things are anyway, how we thought of services and the benefits they'd provide and then presented in detail the guidance you see summarized in this paper. However, it took over a year, 5 complete rewrites and dropping the whitepaper to 1/3 of it's original size (and depth) to get it through internal review before it was published in the form that you see. Personally, I'd rather have given you all the detailed version, but we are where we are.
The paper essentially summarizes a concise set of guidance, helping you make decisions that are right for you while deciding which of Microsoft's distributed systems technologies to use and where.
Now, on to some of the specific comments raised in the thread I mentioned above:
System.Transactions
System.Transactions is brand-new technology which provides a very powerful promotable transaction capability for the first time on any platform. System.Transactions neither depends upon nor requires DTC or COM+ from an architectural perspective, but does promote management of a transaction to the DTC when a transaction *must* be promoted from an in-proc local transaction or a machine-wide transaction to span resources beyond the machine boundary. It is this notion of seamless promotion that is (for me at least) most exciting about System.Transactions. System.Transactions is a feature of .NET Frameworks 2.0 and is used by both Indigo and COM+ for local, machine-wide and distributed transactions on the Microsoft platform. What Indigo adds to this picture is the ability to engage in WS-AtomicTransactions for cross-platform and (potentially) cross-organizational transaction negotiations.
Distributed Transactions
The nature of distributed transactions is broad, complex and varied. In the whitepaper, I defined transactions in this way:
A transaction in this context is a two-phase commit transaction often associated with databases such as SQL Server or other transacted resources including MSMQ. The purpose of transactions is to ensure that two or more changes applied across two or more transacted resources are completed atomically, or if there is a failure or problem detected during the transaction, that all changes are reversed so that no partially updated data is left in the system.
On the thread, Peter Lin & StarTrooper (are you guys reading this?) seemed to be rather upset by my definition of a transaction. Here's what they have to say:
I don't like this definition of transactions from the article. The purpose of transactions in a distributed environment isn't just a simple commit/rollback or atomicity. In real world distributed transactions, the systems have different transaction thresholds and states. The point of distributed transactions is to provide a normalized way of handling difference in state and manage different transaction thresholds.
I'm sorry if you guys don't like my definition of a transaction, but if you'd be so kind as to go and read any books on transaction processing like Jim Gray's classic "Transaction Processing: Concepts and Technologies" or Philip Bernstein & Eric Newcomer's "Transaction Processing for the Systems Professional" and you'll find very clear and explicit definitions of the terms and concepts. Yes, there are other definitions and other transaction types and concepts that exist (compensating transactions, queued transactions, etc.). Yes, transactions can be nested. Yes, you can override default isolation levels to let parts of your app read partially/un-committed data if you really want to. Yes, you can build a system from compensating transactions. Yes, you can build transactional queued apps. Yes, the term "transaction" has been horribly overridden and misused - how many people have seen the term transaction being used where operation or action would have been more appropriate?
HOWEVER, by and large, when we talk about transactions and distributed transactions we are really talking about keeping data, state and information consistent. Consistent Data == Two Phase Commit transactions == Distributed Transactions == Local Transactions == Machine-wide Transactions. And before you flame me again == is (= x 2) which means "equivalent" or "related" to!
And that's what I stated clearly in my paper - I specifically defined the type of transactions I was discussing and the fact that transactions are most often associated with databases or data stores such as SQL Server. I did this because I was trying to convey that many developers use transactions unnecessarily and that they incur locks where no locks are needed significantly harming their systems' scalability and often introducing deadlocks and livelocks where none should exist. Finally on this subject, this paper was not an exhaustive treatise of transactions - it deals with some important scenarios and some general guidance that applies to many (if not most), but not all possible scenarios out there in the wild. In the context I presented the discussion, I stand firmly behind my words.