ACID v BASE

May 21, 2013

Data Grid, NOSQL

It started with a post on High Scalability about ATMs, ACID transactions, and BASE (link). It continued on Hacker News (link).

It ended with this:

The system is BASE. The components are ACID.

ACID, Transactions, and NoSQL

Atomicity. Consistency. Isolation. Durability.

Transactions are required for atomicity. However, NoSQL databases may not require multiple writes and thus may not require (local) transactions. For example, multiple checks deposited at an ATM. If the deposit is written to a relational database, there may be a write to a ‘deposit’ table and multiple writes to a ‘line items’ table in form multiple rows. If the deposit is written to a NoSQL database, there may be a single write in the form of a wide row / object / document. A relational database is required for consistency (e.g. integrity constraints). However, NoSQL databases are more or less schema-less and thus sacrifice consistency (in ACID).

Note: JBoss Data Grid is a NoSQL database that guarantees ACID properties and supports transactions (local and distributed).

Note: While column oriented, document, key / value, and other NoSQL databases typically do not support transactions, there are those that do. For example, graph databases.

CAP

Consistency. Availability. Partition Tolerance.

ACID relates to the consistency in centralized, relational databases. CAP relates to the consistency in distributed systems. A distributed system is consistent if all of the data is up to date. It is available if clients can read and write all of the data. However, a distributed system can’t be both consistent and available in the presence of a partition. Transactions do not solve this problem.

BASE

Basically Available. Soft-State. Eventually Consistent.

Centralized, relational databases are CA (consistent / available). They do not to tolerate partitions, they are not distributed. Distributed, relational databases are CP (consistent / partition tolerant). In the presence of a partition, availability is sacrificed in order to maintain consistency. However, the business cost of sacrificing availability may be greater than the business cost of sacrificing consistency. A number of NoSQL databases are AP (available / partition tolerant). They are eventually consistent.

Note: I interpret basically available to mean AP with support for reduced availability.

ACID + BASE

ACID applies to both CA (centralized) and CP (distributed) databases whereas BASE applies to AP distributed systems. A distributed system with ACID components, centralized or distributed, may be BASE. It is consistent at the micro level, and available at the macro level. For example, multiple checks deposited at an ATM. The ATM might write the deposit to a local, relational database. It is an ACID component. However, the ATM might write deposits to a data center asynchronously. The distributed system is BASE.

, , , , ,

About Shane K Johnson

Technical Marketing Manager, Red Hat Inc.

View all posts by Shane K Johnson

One Comment on “ACID v BASE”

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.

Join 117 other followers

%d bloggers like this: