27

From my understanding, the consistency in ACID is ensuring the data integrity.

However, the consistency in CAP means the data can appear quickly in distributed system.

Does that mean: they are not the same concept?

Yang Xia
  • 373
  • 1
  • 3
  • 4

3 Answers3

25

They are not really the same, because of the scope of the data

ACID

CAP

  • Consistency (All Nodes Have Same Data via Eventual Consistency)
  • Availability
  • Partition-Tolerance : system continues to operate despite arbitrary message loss or failure of part of the system

SYNOPSIS

  • ACID addresses an individual node's data consistency
  • CAP addresses cluster-wide data consistency
RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
5

CAP theorem: specifies that a distributed system can provide two services (ex. Availability and Partition tolerance) but never three. If for example, a service provides Availability and Partitioning it can never ensure Consistency, not immediately, thus Eventual Consistency is used, which allows the infrastructure to flux between inconsistency and consistency, however at one point, sooner or later, the infrastructure will become consistent, resulting in eventual consistency. Cloud services work in such fashion and Amazon's Simple DB uses eventual consistency.

ACID features are usually applied to relational DBs. If you want to apply ACID in a distributed fashion (distributed DB), ACID uses 2PC(two-phase commit) to force consistency across partitions. However since ACID provides consistency and partitioning, applying the CAP theorem for (distributed environments) this will mean that availability is compromised.

Because of this, BASE (Basically available, soft state, eventually consistent) is used which can provide levels of scalability that cannot be obtained with ACID.

Hope this helps.

Stefan M
  • 51
  • 1
  • 1
0

Regarding Consistency in the CAP theorem Julian Brown writes in his article (http://www.julianbrowne.com/article/brewers-cap-theorem):

A service that is consistent operates fully or not at all. Gilbert and Lynch use the word “atomic” instead of consistent in their proof, which makes more sense technically because, strictly speaking, consistent is the C in ACID as applied to the ideal properties of database transactions and means that data will never be persisted that breaks certain pre-set constraints. But if you consider it a preset constraint of distributed systems that multiple values for the same piece of data are not allowed then I think the leak in the abstraction is plugged (plus, if Brewer had used the word atomic, it would be called the AAP theorem and we’d all be in hospital every time we tried to pronounce it).

Thus the C in CAP would correspond to the A in ACID.

With Gilbert and Lynch he refers to the article "Seth Gilbert and Nancy Lynch: Brewer's conjecture and the feasibility of consistent, available, partition-tolerant web services"

white_gecko
  • 139
  • 3