Skip to main content

CAP Theorem and Consistency Models

Learn CAP Theorem and Consistency Models (Phase 9 · Distributed Systems (Core), Microservices) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

CAP theorem • In a distributed data store you can provide at most two of three: Consistency (every read sees the latest write: linearizability), Availability (every request to a non-failing node gets a response) and Partition tolerance (the system continues despite network partitions). Network partitions will happen, so the real choice during a partition is CP (refuse/err to stay consistent) or AP (answer with possibly stale data). • Examples: CP : ZooKeeper, etcd, Consul KV, HBase, MongoDB (default majority), relational primary with sync replication. AP : Cassandra, DynamoDB (eventual),...

More lessons in Phase 9 · Distributed Systems (Core)