Working for Atomikos, I use two-phase commit a lot. While I don’t want to claim that it is a solution to all problems, I do find it frustrating to hear people proclaiming that they don’t use it because it doesn’t scale (or some other reason).
Take, for instance, Werner Vogel’s talk about the Amazon architecture. Once again, two-phase commit is rejected as a viable solution/technology. Once again, I disagree.
Let me illustrate my point with an example of what really happened to me recently - after ordering a book at Amazon (ironically;-). I can give similar examples with airline ticket reservations but those will have to wait until later…
So what happened really? Well, I ordered a book that I really wanted to have. I ordered it online at Amazon… All went well, I checked out and paid by VISA. However, that is where things started to go wrong: while waiting for the book to be delivered, I suddenly get an email from Amazon saying that… my order has been canceled!
Canceled? Yes, but not in a way you would think: I still had to pay for the delivery by DHL (sorry, what is that?!). Yes sir, DHL claimed they had found nobody present at the delivery address. The delivery was at our office address, so it is very unlikely that nobody be there in the first place. Moreover, any courier service I know will leave a note that they passed by and at least settle for an alternative delivery. Not this time.
My conclusion? DHL did not arrive at my place. On the Amazon order tracking page, my order had not even left Germany (to be delivered where I live, in Belgium).
Now what will I remember? I will remember that Amazon ripped me off, either directly or via DHL. I will also remember to be very suspicious about people who say they don’t need two-phase commit. Two-phase commit comes down to ensuring agreement between the different parties involved in a transaction. Clearly, there was no such thing in my case.