Q: What is CAP Theorem?
|Consistency||All nodes see the same data at the same time|
|Availability||Every request receives a response|
|Partition tolerance||System continues to function even if communication fails between nodes|
What does CAP Theorem tell us?
It is impossible for a web service to provide the three following guarantees : Consistency, Availability and Partition-tolerance.
To be consistent, all nodes should see the same set of updates in the same order.
Q: Does it mean I can only get two of CAP?
CAP is frequently misunderstood as if one has to choose to abandon one of the three guarantees at all times.
In fact, the choice is really between consistency and availability only when a network partition or failure happens; at all other times, no trade-off has to be made.
- Traditional RDMBS usually choose consistency over availability.
- NoSQL DB choose availability over consistency.
CP – consistency and partition tolerance
Waiting for a response from the partitioned node might result in a timeout error. CP is a good choice if your business needs require atomic reads and writes.
AP – availability and partition tolerance
Responses return the most recent version of the data available on a node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.
AP is a good choice if the business needs allow for eventual consistency or when the system needs to continue working despite external errors.
Q: What is BASE?
Basically Available, Soft State, Eventual Consistency
Q: Different types of consistency models?