CAP Theorem
During a network partition a system must choose between consistency (linearizability) and availability.
🎯 Interview angle
P is not optional. 'Pick two' is misleading - CAP is a conditional about behaviour during a partition, and most databases are tunable per request.
PACELC
If Partition then Availability or Consistency; Else Latency or Consistency.
🎯 Interview angle
The 'else' clause describes 99.99% of your operating time and shapes p99 far more than partitions ever will.
Linearizability
Operations appear to take effect instantaneously at a single point between invocation and response - the single-copy illusion.
🎯 Interview angle
This is CAP's C. Distinct from ACID's C, which means constraints hold. Correcting that conflation reliably scores.
Causal Consistency
Causally related operations are observed in order by everyone; concurrent operations may differ per observer.
🎯 Interview angle
The sweet spot most products actually need. Nobody notices a like count off by one; everybody notices a reply appearing above its message.
Quorum (R + W > N)
With N replicas, requiring W acknowledgements on write and R on read guarantees the sets overlap.
🎯 Interview angle
Necessary but not sufficient for linearizability - you also need read repair and anti-entropy. Saying so is an expert-level detail.
Raft
A consensus algorithm using randomised election timeouts, one vote per node per term, and majority commit.
🎯 Interview angle
Two majorities of the same set must overlap, so split brain is impossible. Always use odd cluster sizes - four tolerates no more failures than three.
Fencing Token
A monotonically increasing number issued with a lock, checked and enforced by the protected resource.
🎯 Interview angle
The only real fix for TTL-based locks. A GC pause can outlast any lease, so safety must be enforced at the resource, not at the lock.
CRDT
A data type whose merge is commutative, associative and idempotent, so replicas converge regardless of update order.
🎯 Interview angle
Makes conflicts mathematically impossible rather than resolved. Why collaborative editors work offline. Costs metadata growth and restricted operations.
Saga
A sequence of local transactions, each with a compensating action, replacing a distributed transaction.
🎯 Interview angle
You give up isolation: intermediate states are visible. Order irreversible steps last, and remember compensations are not true inverses - a refund is not an un-charge.
Transactional Outbox
Write the event as a row in the same transaction as the state change; a relay publishes it afterwards.
🎯 Interview angle
Eliminates the dual-write problem. Publishing is at-least-once by construction, which is why consumers must be idempotent.
Exactly-Once Processing
At-least-once delivery combined with idempotent consumers that deduplicate, committing the dedup record with the side effect.
🎯 Interview angle
Exactly-once *delivery* is impossible - the sender cannot distinguish a lost message from a lost ack. Saying that precisely is the whole point.
Idempotency Key
A client-generated unique key stored with a uniqueness constraint so a retry replays the stored response instead of re-executing.
🎯 Interview angle
Insert first and catch the unique violation - never read-then-write, which races. Commit the key and the effect in one transaction.