Sobes.tech
Intern

Tell me about the CAP theorem: what is it about, examples of databases?

sobes.tech AI

Answer from AI

The CAP theorem states that a distributed system cannot simultaneously guarantee three properties: Consistency, Availability, and Partition tolerance. You can choose at most two of the three:

  • Consistency — all nodes see the same data at the same time.
  • Availability — each request receives a response (success or error) without long delays.
  • Partition tolerance — the system continues to operate even if part of the network is unavailable or messages are lost.

Examples of databases:

  • CP (Consistency + Partition tolerance): HBase, MongoDB (in strong consistency mode) — they may sacrifice availability during network partition.
  • AP (Availability + Partition tolerance): Cassandra, Couchbase — they may have data discrepancies during network partition, but remain accessible.
  • CA (Consistency + Availability): traditional relational databases (e.g., MySQL) in a single-node environment, where there are no network partitions.

In real distributed systems, it is always necessary to balance these properties depending on application requirements.

Tell me about the CAP theorem: what is it about… - sobes.tech