CAP, PACELC & consistency models
- CAP
- During a network Partition, choose Consistency (refuse/err) or Availability (answer, possibly stale). P isn't optional in distributed systems.
- PACELC
- …Else (no partition), trade Latency vs Consistency. More useful day to day than CAP.
- Strong consistency
- Every read sees the latest write. Needs coordination (consensus, quorum) → slower.
- Eventual consistency
- Replicas converge if writes stop. Fast and available; reads may be stale.
- Quorum (R + W > N)
- With N replicas, writing to W and reading from R guarantees overlap → you read the latest value.
1. Bank balance during a partition — C or A?
2. Like counts on a post during a partition?
3. N=3. Which (W, R) guarantees reading the latest write?
Answered 0 / 3
Explain Pick a shard key for a multi-tenant SaaS app's tables and explain the trade-off.