Sobes.tech
Middle+

What is the CAP theorem?

sobes.tech AI

Answer from AI

The CAP theorem is a fundamental concept in distributed systems, formulated by Eric Brewer. It states that in a distributed system, it is impossible to guarantee all three properties simultaneously:

  • Consistency: All nodes see the same data at the same time.
  • Availability: Every request receives a response (successful or error) without guarantee that it contains the most recent data.
  • Partition tolerance: The system continues to operate despite loss of communication or delays between nodes.

In the event of a network partition, the system must choose between consistency and availability. That is, when communication between nodes fails:

  • Either the system refuses to respond to maintain consistency (CP system).
  • Or it responds with possible loss of consistency to maintain availability (AP system).

Examples:

  • Cassandra — AP system.
  • HBase — CP system.

The CAP theorem helps in designing distributed systems by understanding the trade-offs between these three properties.