Skip to content

CAP Theroem

A distributed DB will only choose two of them

  • C: Consistency
  • A: Availability
  • P: Partition tolerance

Any two of them:

  • C+A: Not distributed DB
  • C+P: DB need to be consistency. Hence when some of the hosts is unreachable, the db will reject user to read or write.
  • A+P: DB always allow user to read and write then db will not be consist when network is broken.

C ↔️ A is more like spectrums

Example:

  • Cassandra: Availability > Consistency
  • Bank: Consistency >>> Availability (Consistency is very important for money!)
  • Redis: Consistency > Availability
  • RDBMS: Consistency > Availability

Ref: https://github.com/henryr/cap-faq

Changelog

Just observe 👀