Distributed Systems
Distributed Systems
CAP Theorem
Consistency, Availability, Partition Tolerance — the fundamental tradeoff in distributed systems
PACELCExtends CAP: during partitions choose A or C; else choose Latency or Consistency
Consistency ModelsLinearizability, sequential, causal, eventual consistency, and session guarantees
Idempotency & Exactly-Once SemanticsSafe retries, idempotency keys, delivery guarantees, Kafka exactly-once, deduplication patterns
Distributed LockingRedis SETNX, Redlock, fencing tokens, ZooKeeper znodes, and when not to use locks
Leader ElectionBully algorithm, Raft election, ZooKeeper znodes, split-brain prevention, STONITH
Gossip ProtocolFan-out convergence, phi accrual failure detection, SWIM, Merkle tree anti-entropy
Quorum Reads & WritesR + W > N overlap rule, tuning configurations, sloppy quorum, hinted handoff, read repair
Saga PatternOrchestration vs choreography, compensating transactions, execution log, and isolation countermeasures
Outbox PatternDual-write problem, CDC with Debezium, at-least-once delivery, and inbox deduplication
Logical ClocksLamport timestamps, vector clocks, version vectors, and Hybrid Logical Clocks
Multi-Region DesignActive-passive, active-active, geo-routing, CRDTs, conflict resolution, and data sovereignty