CAP Theorem

#software-architecture#database

Brewers Theorem about distributed databases states that from Consistency, Availabillity and Partition Tolerance, only two can be taken.

  • Consistency: Every read receives the most recent write or an error
  • Availability: Every request receives a (non-error) response, without the guarantee that it contains the most recent write
  • Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped/delayed by the network between nodes

CAP

Databases CAP Categorization

CAP DBs

Cassandra

  • Eventual Consistency
  • Lightweight transactions
  • Guaranteed batched writes

MongoDB

  • Replica Sets
  • Primary for writes, Secondaries for reads
  • Consistent by default

PostgreSQL

  • Performance impact due to synchronization of changes
  • Hot Standby/Streaming Replication