CAP Theorem

Applies to a database with multiple or single (by default, no partition tolerance) nodes

  • Consistency – the data retrieved from one database node is always the same as the data retrieved from another
  • Availability – the database always returns a valid reply to a database query
  • Partition Tolerance – the database continues to operate despite a partition failure (node or communication delay or failure)

Only two out of three can be provided at any given time

  • Sacrifice partition tolerance – a system with either a single node or that terminates entirely when a node goes down. This ensures that data is consistent and available when the database is running, but defeats the purpose of having databases with multiple nodes.
  • Sacrifice consistency – database always returns a valid reply, but the data on one node may be different than the data on another
  • Sacrifice availability – system returns error if data is not consistent across nodes. This ensures data is up-to-date, but may result in delays retrieving data.

Applications in which accuracy is more important (typically relational) databases will sacrifice availability, whereas applications in which speed is more important (typically NoSQL) will sacrifice consistency.

Leave a Reply