Freigeben über


Why I hate the phrase "Long Running Transactions"...

I always talk about "Long Running Work" and steadfastly avoid "Long Running Transactions"... My preference is to use the word "transaction" to mean an atomic operation that occurs at a single service within a second or so. I mean the ACID (Atomic Consistent Isolated Durable) transactions that usually involve holding locks and that we transaction theorists love.

Whenever I hear about a "Long Running Transaction", I wonder about where it ends. Let's consider the following example:
1) I decide to take a trip to Europe so I book some airline and hotel reservations.
2) The hotel in London hits a threshold of occupancy and decides to increase staffing and food for the restaurant.
3) The hotel orders more food from the Green Grocer.
4) The Green Grocer hits a threshold and orders another delivery from its shipper.
5) The shipping company hits a thresold and orders more diesel fuel for its trucks...
6) Two weeks later, I cancel my trip.

So, if I believe in long-running-transactions, the shipping company doesn't need any more diesel fuel! I don't think so!

The long-running-transaction approach assumes that there is a cohesive set of work across loosely-coupled and independent systems that is atomic. Notice it is not ACID in that Isolation is clearly different and Consistency is clearly different. Hence, you would consider these "long-running-transactions" to exhibit Atomicity and Durability. I am arguing that Atomicity is not a property that flows across multiple services as the semantics of interaction across these services is not tightly associated.

My preference is to talk about "long-running-work" across two services. I can examine the semantic interaction of two services across a set of messages. This leads to the notions of reliable messaging (and multi-message dialogs) which is one of my favorite topics and something I will be posting more work to my website (www.pathelland.com) soon. It also leads to the notion of a contract across the messages that flow between two services. I love these concepts. 

Another concept that I am strongly in favor of is the concept of a service being in the midst of multiple related dialogs. My attempt to book travel arrangements puts me in multiple interactions with different airlines and hotels. These interactions involve multiple messages and continue at least until the date of my travel (unless I cancel). When my incoming reservation causes the hotel to increase its food requirements, the hotel will use business logic to control the relationship between my incoming messages and the restaurant related messages. This allows it to consider the wisdom of canceling the food order when I cancel my reservation... very different than mindlessly assuming some coordinator associates these into a long-running-transaction.

Work flows across services and businesses in ways that do not magically "undo" even if you do master the use of compensations rather than the classic "undo" of replacing the before values. The behavior of our interconnected systems is more an integration of lots of disparate work into summaries. When I through a rock into the ocean by San Francisco, that can and does impact the waves that hit Tokyo but only in conjunction with countless other stimuli.

This is why I like to talk about long-running-work inside a single service or across exactly two services using a multi-message dialog. The phrase long-running-transaction is a chimera and leads to a false hope of simplicity. The reality is much richer and more complex.

Love, Pat

Comments