CAP Theorem

In theoretical computer science, the CAP theorem, also named Brewer's theorem after computer scientist Eric Brewer, states that it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:

  • Consistency: all nodes see the same data at the same time
  • Availability: a guarantee that every request receives a response about whether it succeeded or failed
  • Partition tolerance: the system continues to operate despite arbitrary partitioning due to network failures

因為在分散式系統中,網路是不穩定的,P是一定要選擇的,要選擇C或A就要看需求.

  • 選擇CP:response有可能會timeout.
  • 選擇AP:放棄C,退而要求Eventually Consistency.選擇A,response會在一定時間內回應,不管成功或失敗.

Cassandra可以動態切換成CP/AP.


References: