Distributed Systems

Distributed Systems

Raft, consensus, CRDTs, vector clocks, BFT, quorum systems, 2PC.

86Articles
86Topics covered
Articles in this category

All 69 articles, sorted alphabetically

ARTICLE · 01

The CAP Theorem

The CAP Theorem explains why distributed systems cannot guarantee consistency, availability, and partition tolerance simultaneously. Understand the tr…

Read article →
ARTICLE · 02

In Search of a Leader: Understanding Raft Consensus - AICassindra

In the world of distributed systems, getting a cluster of nodes to agree on something—like the order of log entries—is notoriously difficult.

Read article →
ARTICLE · 03

API Gateway Patterns

Kong, Ambassador, AWS API Gateway. Auth (JWT validation), rate limits (per API key), routing (path-based, host-based, weighted), request/response tran…

Read article →
ARTICLE · 04

Bulkhead Pattern

Isolate resources per feature. Prevent noisy neighbor.

Read article →
ARTICLE · 05

Byzantine Fault Tolerance, in depth: the 3f+1 bound, PBFT's three phases, HotStuff's linear view change, and when BFT earns its cost

Byzantine fault tolerance from first principles: what the Byzantine fault model covers, why n must be at least 3f+1, partial synchrony and what it mea…

Read article →
ARTICLE · 06

CAP Theorem + PACELC Extension, in depth: what the proof actually says, the latency cost of consistency when nothing is broken, and choosing per operation

CAP and its PACELC extension explained precisely: the Gilbert and Lynch definitions, three common misreadings, why replication forces a latency versus…

Read article →
ARTICLE · 07

Chaos Engineering, in depth: injecting partitions, pauses, latency and clock faults into a distributed system and checking safety, not just uptime

Chaos engineering for distributed systems: a partial-fault model, tc netem, iptables, Toxiproxy and Chaos Mesh injection by layer, safety hypotheses c…

Read article →
ARTICLE · 08

Circuit Breaker Pattern

Fail fast when dependency down. Prevent cascade failures.

Read article →
ARTICLE · 09

Clocks in Distributed Systems, in depth: physical drift, wall versus monotonic time, timestamp ordering, Lamport clocks and choosing the right clock

A map of time in distributed systems: how hardware clocks drift and get synchronized, wall-clock versus monotonic clocks in code, why last-write-wins …

Read article →
ARTICLE · 10

Consistent Hashing, in depth: Rings, Virtual Nodes and the Alternatives

Consistent hashing from first principles: ring lookup code, why one token per node is unbalanced and what virtual nodes cost, measured key movement, z…

Read article →
ARTICLE · 11

CQRS, in depth

CQRS without event sourcing: the three levels of separation, command handlers with optimistic versions, why dual writes fail, outbox and CDC propagati…

Read article →
ARTICLE · 12

CRDTs in Production, in depth: choosing data types, syncing with state vectors, storing and compacting history, evolving schemas and securing merges

What it takes to run conflict-free replicated data types in a real product: picking counter, register, set, map and sequence types by their surprising…

Read article →
ARTICLE · 13

Anti-entropy -- healing divergence between replicas

Deep-dive on anti-entropy: the replica-divergence problem, background reconciliation, Merkle trees for efficient difference detection (O(1)/log(n)), r…

Read article →
ARTICLE · 14

Bounded staleness architecture

Deep-dive on bounded-staleness consistency: version-based and time-based bounds, follower applied position and lag, read-path enforcement (serve, wait…

Read article →
ARTICLE · 15

Causal consistency architecture

Deep-dive on causal consistency: the happened-before relation and session guarantees, dependency tracking with vector clocks, hold-until-ready applica…

Read article →
ARTICLE · 16

Chain replication -- strong consistency with simple roles

Deep-dive on chain replication: the chain structure (head to tail), writes propagating down and committing at the tail, reads from the tail (committed…

Read article →
ARTICLE · 17

Google Chubby, in depth: a coarse-grained lock service, its sessions, KeepAlives and cache invalidation, master failover, and the lessons that shaped ZooKeeper and etcd

How Google's Chubby lock service works, from the 2006 OSDI paper: why a lock service rather than a consensus library, the cell and master lease, …

Read article →
ARTICLE · 18

Raft consensus architecture, in depth: deploying a Raft group, commit latency maths, placement, Multi-Raft and operations

Raft as a deployed component: where consensus belongs, the node pipeline from proposal to apply, commit latency from fsync and placement, sizing and m…

Read article →
ARTICLE · 19

Raft Consensus, in depth: from the rules in the paper to a production node

Raft as you would implement and operate it: persistent state and fsync ordering, the vote and append handlers as code, why leaders only count replicas…

Read article →
ARTICLE · 20

CRDT replication architecture

Deep-dive on CRDT replication: state-based vs op-based vs delta CRDTs, join-semilattice merges, OR-Sets and PN-counters, version vectors and dots, seq…

Read article →
ARTICLE · 21

Distributed Hash Table Architecture in Depth

DHT architecture in depth: one id space for keys and nodes, virtual nodes, Chord fingers vs Kademlia k-buckets vs Pastry prefixes, join/leave converge…

Read article →
ARTICLE · 22

etcd, in depth: the revisioned key space, Raft, transactions, watches and leases, and how to keep a cluster healthy

etcd from first principles: what it is for, how a member is built (gRPC, Raft, WAL, MVCC on bbolt), revisions and history, linearizable versus seriali…

Read article →
ARTICLE · 23

Fencing tokens -- making distributed locks safe against pauses

Deep-dive on fencing tokens: the paused-lock-holder problem (GC/network/VM pauses past the lease), the monotonic fencing token issued per grant, resou…

Read article →
ARTICLE · 24

Gossip-Based Membership, in depth: SWIM probing, suspicion and incarnations, piggybacked dissemination and Lifeguard

How clusters agree on who is alive without a coordinator: why all-to-all heartbeats do not scale, the SWIM probe cycle with indirect pings, suspicion …

Read article →
ARTICLE · 25

Gray failure architecture

Deep-dive on gray failure: the degraded component whose shallow health check passes while real requests suffer, why differential observability is both…

Read article →
ARTICLE · 26

Hinted handoff

Deep-dive on hinted handoff, the Dynamo-style mechanism that preserves write availability when a replica is temporarily down: a live custodian stores …

Read article →
ARTICLE · 27

Hybrid Logical Clocks architecture

Deep-dive on Hybrid Logical Clocks: physical + logical combined, update rule, monotonicity, causality, bounded skew.

Read article →
ARTICLE · 28

Distributed Leader Election Architecture in Depth

Leader election as a two-layer architecture: Raft elections inside etcd, PreVote and CheckQuorum, lease-based election for your own service, Kubernete…

Read article →
ARTICLE · 29

Leases -- time-bounded exclusive rights

Deep-dive on distributed leases: the safe-exclusive-access need, the time-bounded grant, expiry (auto-release), renewal (by the live holder), contrast…

Read article →
ARTICLE · 30

Merkle tree architecture

Deep-dive on Merkle trees for replica reconciliation: leaf hashes over key ranges, parent hashes up to a single root, root-then-descend comparison, dr…

Read article →
ARTICLE · 31

Operational transformation architecture

Deep-dive on OT for collaborative editing: the operation model, the transformation function and TP1/TP2, the Jupiter central-server model, client pend…

Read article →
ARTICLE · 32

Transactional outbox architecture

Deep-dive on the transactional outbox pattern: how writing the business change and the event to publish in one local database transaction eliminates t…

Read article →
ARTICLE · 33

Paxos

How classical Paxos works: proposers, acceptors, learners, and the two-phase protocol that achieves consensus.

Read article →
ARTICLE · 34

Phi-accrual failure detectors, in depth: per-peer state, Cassandra and Akka internals, pause guards and threshold calibration

How phi-accrual failure detectors work inside production systems: per-peer windows, the exponential model in Cassandra and the normal model in Akka, l…

Read article →
ARTICLE · 35

Quorum systems

Deep-dive on quorum-based replication: the R+W>N overlap guarantee, tunable consistency levels, timestamp vs vector-clock versioning, read repair a…

Read article →
ARTICLE · 36

Raft log replication

Deep-dive on Raft log replication: leader-based writes, log entries with term/index/command, AppendEntries replication, majority commit for fault tole…

Read article →
ARTICLE · 37

Read repair and anti-entropy architecture

Deep-dive on the repair mechanisms behind leaderless eventual consistency: read repair on the coordinator's read path with the digest optimizatio…

Read article →
ARTICLE · 38

Saga Pattern, in depth: compensations, the pivot step, a durable orchestrator and the isolation you give up

How the saga pattern keeps multi-service business transactions consistent without distributed locks: compensatable, pivot and retriable steps, orchest…

Read article →
ARTICLE · 39

Split Brain, in depth: how two leaders happen, what they break, and how quorum, leases, fencing and STONITH stop them

Split brain explained from first principles: how network partitions, asymmetric links and process pauses create two active leaders, what dual writes d…

Read article →
ARTICLE · 40

Total order broadcast architecture

Deep-dive on total order (atomic) broadcast: the agreement, total-order, validity, and integrity guarantees, equivalence to consensus, leader-sequence…

Read article →
ARTICLE · 41

Vector clock architecture, in depth: causal delivery, consistent cuts and debugging distributed traces

Vector clocks as event-level infrastructure: a clock layer between application and transport, causal broadcast with a hold-back queue, recovering cons…

Read article →
ARTICLE · 42

Vector Clocks in Depth: Tracking Causality, Detecting Concurrent Writes and Keeping the Metadata Bounded

How vector clocks capture happens-before exactly: first principles, the update and comparison rules with Python code, a worked three-process example, …

Read article →
ARTICLE · 43

Replication watermarks architecture

Deep-dive on watermarks in a replicated log: the high-water mark as the committed, safe-to-read boundary computed from the minimum offset replicated t…

Read article →
ARTICLE · 44

ZooKeeper architecture, in depth: znodes, the ensemble, Zab, sessions, watches, consistency guarantees and how to run it

How Apache ZooKeeper works from the inside: the znode data model and node types, leaders, followers and observers, the Zab atomic broadcast and zxids,…

Read article →
ARTICLE · 45

Distributed Locking Patterns, in depth: database locks, Redis, Redlock, ZooKeeper and etcd, and fencing

A catalogue of distributed locking patterns and how to choose: efficiency versus correctness locks, why leases need fencing tokens, database row and a…

Read article →
ARTICLE · 46

Distributed Tracing with OpenTelemetry, in depth: causality, the propagation contract, trust boundaries, clock skew and trace completeness

Distributed tracing as a distributed-systems problem: the causal span model, W3C traceparent, tracestate and baggage, where propagation breaks, durabl…

Read article →
ARTICLE · 47

Distributed Transactions, in depth: 2PC and 3PC as state machines, termination rules and a crash-point model check

Atomic commitment from first principles: 2PC and 3PC as participant state machines, why the prepared state blocks, how the 3PC pre-commit round and te…

Read article →
ARTICLE · 48

Calvin, in depth: deterministic distributed transactions without two-phase commit

How Calvin agrees on transaction inputs before execution: 10 ms sequencer epochs, Paxos or async input replication, deterministic locking, active and …

Read article →
ARTICLE · 49

Distributed Transactions in Practice, in depth: choosing between co-location, XA, distributed SQL, sagas and idempotent retries

A practical guide to making changes atomic across machines and services: the decision ladder, how two-phase commit and XA fail in production, how Perc…

Read article →
ARTICLE · 50

The Dynamo Paper, in depth: how Amazon's always-writable key-value store composed six techniques, and what its descendants kept

A first-principles reading of Amazon's 2007 Dynamo paper as a whole system: the requirements that forced each design choice, how consistent hashi…

Read article →
ARTICLE · 51

Event Streaming Patterns, in depth: notification vs state transfer, fan-out, outbox, compacted tables, idempotent projections and dead letters

A practical catalogue of event streaming patterns on a partitioned log: event notification versus state transfer, fan-out with consumer groups, outbox…

Read article →
ARTICLE · 52

Failure Detectors and Phi Accrual, in depth: completeness, accuracy, the detector classes, and building timeout, phi and SWIM detectors that behave in production

How distributed failure detectors really work: why they can only suspect, completeness and accuracy, the Chandra-Toueg classes, detection time and mis…

Read article →
ARTICLE · 53

Google Spanner and TrueTime, in depth: commit wait and its proof, timestamp rules, safe time for replica reads and what to copy without atomic clocks

How Spanner uses TrueTime for external consistency: the interval API and the 2012 uncertainty figures, the Start and Commit Wait rules with the four-s…

Read article →
ARTICLE · 54

Gossip Protocol for Cluster Membership, in depth: epidemic dissemination, versioned state and digest reconciliation

How gossip spreads cluster membership state: push, pull and push-pull epidemics with a simulation and measured round counts, versioned endpoint state …

Read article →
ARTICLE · 55

What Jepsen Taught Us, in depth: histories, nemeses, checkers and the failure patterns that keep coming back

What a decade of Jepsen analyses teaches about distributed systems: how a Jepsen test is built, why indeterminate operations matter, how Knossos and E…

Read article →
ARTICLE · 56

Kubernetes Operator Pattern, in depth: level-triggered reconcile loops, CRD design, finalizers and running operators safely

How Kubernetes operators work from first principles: informers, deduplicating workqueues and level-triggered reconciliation, spec and status design wi…

Read article →
ARTICLE · 57

Leader election algorithms, in depth: bully, ring, quorum-and-term and lease-based election compared, with code and fencing

A comparative guide to leader election algorithms: the safety and liveness problem, the bully algorithm, ring algorithms (LCR, Chang-Roberts, Hirschbe…

Read article →
ARTICLE · 58

Linearizability vs Sequential Consistency, in depth: histories, real-time order, a working checker, composability, cost, and where real systems land

A first-principles comparison of linearizability and sequential consistency: operation histories, the one difference (real-time order), worked histori…

Read article →
ARTICLE · 59

Quorum Systems Explained, in depth: the intersection property, majorities, weighted votes, grids, Flexible Paxos and Byzantine quorums

Quorum systems from first principles: why intersection is the only property that matters, majority and weighted voting, grid quorums and the load vers…

Read article →
ARTICLE · 60

Quorum Writes and Reads, in depth: the coordinator request path, what a timeout really means, and why R plus W over N is not linearizable

What happens on a quorum write and read in a Dynamo-style store: the coordinator, digest reads, blocking read repair, hinted handoff and sloppy quorum…

Read article →
ARTICLE · 61

Raft Consensus Algorithm, in depth: the five safety properties as code, deterministic simulation, and the bugs real implementations shipped

How to know a Raft implementation is correct: the algorithm in brief, the paper's five safety properties written as an executable checker, a dete…

Read article →
ARTICLE · 62

Raft Consensus Intuition, in depth: deriving every rule by breaking a simpler design

Build Raft from first principles: start with a primary and a backup, break it with partitions and crashes, and add one rule per failure until you reac…

Read article →
ARTICLE · 63

Retry, Exponential Backoff and Jitter, in depth: what to retry, jitter variants, retry budgets, deadlines and retry amplification

How to retry safely in distributed systems: classifying retryable errors, idempotency keys, exponential backoff with full, equal and decorrelated jitt…

Read article →
ARTICLE · 64

Saga: Choreography vs Orchestration, in depth

Saga choreography versus orchestration in depth: one checkout saga built both ways in code, the cost of adding a step, how each style detects a stuck …

Read article →
ARTICLE · 65

Istio vs Linkerd, in depth: sidecar, ambient and micro-proxy data planes, identity, policy, upgrades and choosing a mesh

Choosing and operating a service mesh: Istio sidecar and ambient mode (ztunnel, HBONE, waypoints) versus Linkerd's Rust micro-proxy, control plan…

Read article →
ARTICLE · 66

Sharding Strategies, in depth: choosing a shard key from your workload

How to choose a sharding scheme from evidence: partition keys versus partition functions, the balls-into-bins imbalance bound and heavy-tailed keys, a…

Read article →
ARTICLE · 67

Two-Phase Commit, in depth: building a coordinator, recovering in-doubt branches and testing every crash point

A hands-on guide to two-phase commit: a runnable coordinator over PostgreSQL prepared transactions, a fenced recovery loop, a crash-point test matrix,…

Read article →
ARTICLE · 68

Two-Phase Commit Revisited, in depth

Two-phase commit at the level of log records: the basic protocol, presumed abort and presumed commit, read-only and one-phase optimisations, the block…

Read article →
ARTICLE · 69

YugabyteDB, in depth: DocDB tablets, Raft per shard, hybrid time transactions and multi-region design

How YugabyteDB works: the YSQL query layer over DocDB, hash and range sharding into tablets, Raft replication with leader leases, hybrid time and dist…

Read article →