Not Quite No Transactions

Paul Brown @ 2007-03-20T02:56:00Z

I enjoyed Dan Pritchett's presentation on The EBay Architecture, but now it seems like people are getting carried away, where the intersection of people with my blogroll contains Martin Fowler. Martin is well-known and rightly regarded as a smart guy, but this fragment from his post on "no transactions" isn't quite right:

The rationale for not using transactions was that they harm performance at the sort of scale that eBay deals with. This effect is exacerbated by the fact that eBay heavily partitions its data into many, many physical databases. As a result using transactions would mean using distributed transactions, which is a common thing to be wary of.

(Unfortunately, Martin's bliki doesn't support comments, or I would be posting this over there.) The relevant bullet from Dan's presentation at SDForum (not the one at QCon) is:

Absolutely no client-side transactions.
∗ Single database transactions managed through anonymous PL/SQL blocks.
∗ No distributed transactions.

This is very different than "no transactions", but the game of telephone is already underway.

The reality is that attempts at being "for sure, for sure" (multi-master replication, two-phase commit, locking, aggressive retry, etc.) can and do inhibit scale. There are also plenty of stupid things you can do to hobble an application without leaving a single database, usually by inadvertently abusing locking. (One classic is a SELECT ... FOR UPDATE that includes a join across a code table.)

In terms of things that can be done to scale, it's a good idea to take the shortest path to a working system. It's a good idea to be intimately familiar with the performance characteristics of a system in production, and that means really, truly understanding how all of the pieces (load balancer, web server, application tier, database, physical network, hardware, etc.) work individually and collectively. It's important to be able to disentangle design choices from business constraints, and this is more or less the point that Assaf made in the original round of discussion about Dan Pritchett's presentation. As Dare Obasanjo and Charlie Wood point out, life without transactions isn't necessarily a picnic, either. Thinking about "what can I live without" in the abstract will lead down the path toward something like what Pat Helland describes in his Life Beyond Distributed Transactions paper, but that journey should be taken in pragmatic steps driven by experiment and experience. (And now that you're out of the jungle, Pat, can you hurry up and go back to blogging?)

Meta

Tags: (tag) (tag) (tag) (tag)

(comment bubbles) 3 comments
1501 direct views

Comment from Whatever @ 2007-03-20T14:45:36Z # permalink

Transactions aren't a substitute for thinking, but reimplementing a half-baked pseudo transactional system with extra problems and fewer genuine advantages is stupid.

People who can't use transactions probably don't understand the relevant issues enough to figure out a transactionless system, and people who understand both transactions and their own particular requirements can build a system customised to their own precise requirements.

If your locking and indexing requirements are sufficiently specialised then there may well be an advantage to specialising your database tools.

On the positive side, the spread of the "transactions are icky and slow" theory is going to create a whole lot of crap, and some extra business for the people who actually know what they're doing, so it's not all bad news.

Comment from Benjamin Mitchell @ 2007-03-27T06:16:34Z # permalink

The link to the Pat Helland paper is broken. It should be: http://www-db.cs.wisc.edu/cidr/cidr2007/papers/cidr07p15.pdf

Comment from Paul Brown @ 2007-03-27T14:22:26Z # permalink

@Benjamin: Fixed. Thanks!