Module 05
Consistency, replication & consensus
- CAP / PACELC
Slice the network between two nodes and choose, per request, between rejecting it (CP) and answering with possibly stale data (AP), then remove the partition and see the latency-vs-consistency trade that remains.
- Consistency models (strong, eventual, causal)
Watch a reply appear before its parent comment under eventual consistency, then switch to causal and see ordering restored.
- Read-your-writes
Dial up replica lag, post a comment, refresh, and see it missing until sticky routing or version tokens fix it.
- Acknowledged vs durable vs processed
Move the point where the API returns 200 along the pipeline and crash things after it to show what the user was actually promised.
- Leader-follower, multi-leader, leaderless quorums
Switch topologies and turn R/W/N quorum knobs to see when reads are guaranteed to overlap the latest write.
- Replication lag & failover
Kill the leader, promote a lagging replica, and watch acknowledged writes disappear (RPO) while the outage clock runs (RTO).
- Split-brain
A partitioned old leader keeps accepting writes, and you see how fencing or quorum-based promotion prevents two leaders.
- Single-region → active-passive → active-active
Climb the three tiers and watch each one's outage behavior, and the new costs it adds: conflicts, global idempotency, and complicated consistency semantics.
- Conflict resolution
Make concurrent edits in two regions and compare last-writer-wins, merge functions, and CRDT counters.
- Consensus (Raft)
Step through votes and log replication one message at a time, forcing split votes, partitions, and stale leaders.
- Distributed locks & fencing tokens
Stretch a GC pause past a lock's TTL to get two writers, then add fencing tokens and watch the stale write rejected.