Eventual Consistency, Explained

December 20, 2007

Werner Vogels, the CTO at Amazon, has a great post about the contentious idea of “eventual consistency” for the new SimpleDB service. The idea that a database could be inconsistent is a little disconcerting to a lot of people — after all, inconsistent means unpredictable, and that just doesn’t fly for us deterministic computer people. Right?

Well, “eventual consistency” isn’t entirely unpredictable. And, it has it’s benefits — especially when it means avoiding locking on highly concurrent read and write operations. That’s exactly what SimpleDB was designed to do. To quote Vogels:

“Inconsistency can be tolerated for two reasons: for improving read and write performance under highly concurrent conditions and for handling partition cases where a majority model would render part of the system unavailable even though the nodes are up and running.

“Whether or not inconsistencies are acceptable depends on the client application. A specific popular case is a website scenario in which we can have the notion of user-perceived consistency; the inconsistency window needs to be smaller than the time expected for the customer to return for the next page load. This allows for updates to propagate through the system, before the next read is expected.”

(from “Eventually Consistent“)

SimpleDB was intentionally designed to behave this way, which means it certainly wasn’t built to replace traditional ACID relational databases for all scenarios. If you think about how often you require immediate consistency in your web applications, you’ll likely find that a very significant portion of your database interactions don’t.

My biggest concern about SimpleDB isn’t consistency or relationships, it’s latency. SimpleDB queries from outside of the Amazon cloud won’t be fast enough to feed sites that require more than a couple of queries per page — unless those queries can be executed in parallel, which isn’t an easy option in single-threaded web environments (PHP, Rails, etc.).

I’m excited to see how it operates with parallel queries, though. If an application is built to make dozens of queries simultaneously, rather than sequentially, the performance could be excellent.

I have a little Java toolkit for querying web services in parallel, and I’m itching to unleash it on SimpleDB. All this hot air blowing isn’t worth much without real numbers, right? :)

About these ads

3 Responses to “Eventual Consistency, Explained”


  1. The pattern I’d like to explore more for concurrent queries is making the queries directly from the browser via Javascript. Shipping application code and database credentials to the client to compose into the user experience seems like the best way to take advantage of cloud-based services. I haven’t looked into it yet, but hopefully SimpleDB provides fine-grained enough access control. If S3 is any indication, Amazon is certainly skilled in this regard.


  2. The R + W > N stuff is from a paper Werner’s team published earlier this year. There’s a lot of interesting info in that paper.

    I think one big thing missing from SimpleDB is some sort of CAS/ETAG value to make conditional PUT’s. Otherwise there’s no way to prevent lost updates that attempt to merge attributes with replace=true.

    ChrisA: we’re thinking exactly the same these days.

  3. Bill Burcham Says:

    SimpleDB is an interesting way-point in the continuum from the traditional DB to the wide web of information.

    Further toward the wide web end I’m intrigued with Dave Sifry’s approach with Hoosgot. Just use the term “hoosgot” in a blot post or twitter @hoosgot and it the post/tweet gets agregated on hoosgot.com

    Seems like a small step from there to a WP plugin that lets me post structured hoosgots. A structured hoosgot (microformat) could have standard bid/offer fields perhaps. Dunno where that’d go. But the idea is that technorati plays the part of the database index.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: