Skip to content

ACID vs BASE

June 2, 2013

Nope, this isn’t a chemistry blog post.

AtomicityConsistencyIsolationDurability (ACID)

Basically AvailableSoft stateEventual consistency (BASE)

These two approaches are governed by the CAP Theorem. The CAP theorem states that no distributed system can provide all 3 of these simultaneously: Consistency, Availability, and Partitioning. Here is a recently update on the relationship and tensions between these 3 desired properties of distributed systems by Eric Brewer: http://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed

As the article above describes, the variables in CAP are continuous and not binary choices. There are examples of how to manipulate the properties to achieve desired results.

Immediate Consistency

Immediate consistency is that the results of updates are visible to all observers immediately. There are a few well known examples of this consistency model. First, the relational DBMS, provides ACID transactions which provide exactly this guarantee. In a distributed database environment, the Two Phase Commit protocol (2PC) provides the atomic consistency needed for immediate consistency so that all data in all system are consistent. Finally, the Paxos consensus algorithms that are used in various large distributed systems inside Google.

Eventual Consistency

Eventual consistency promises that only after some period of time will all observers see the same data. Many NoSQL databases use eventual consistency. Here is the article written by Douglas Terry while at Microsoft that introduced the concept of eventual consistency: Replicated Data Consistency Explained Through Baseball. Also Rick Cattell’s article on Scalable SQL and NoSQL Data Stores.

As an example, let’s examine how Amazon’s Dynamo DB handles eventual consistency. DynamoDB is a key-value store database, which is effectively a distributed hash table. If you’re unfamiliar with DHT’s an interest property for partitioning the keys is called consistent hashing. Obviously, DynamoDB focuses on high availability with the idea that “writes should never fail”. Amazon’s implementation uses Vector Clocks to achieve eventual consistency.

Advertisements

From → General

Leave a Comment

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

%d bloggers like this: