Distributed consensus — Imagine a group of friends trying to pick a meeting time. Each friend proposes a time, and they vote. The friend with the majority becomes the leader who announces the final time…
Leader election — Motivation In a distributed system you often have many identical service instances that can perform the same work. When a task must be performed once (e.g., a cron job, a cleanup…
Distributed locks — Motivation In a distributed system, many processes or services may try to modify the same resource (a row in a database, a file, a cache entry, etc.) at the same time. Without…
Distributed transactions — If any friend says “no” at any step, the whole plan is aborted. This is similar to a two‑phase commit (2PC): a prepare phase where all participants agree, followed by a commit…
Two‑phase commit — When a business operation touches multiple independent data stores (e.g., a PostgreSQL order table and a Redis inventory cache), we want the whole operation to either succeed…
Saga pattern — Motivation In a distributed system, a single business transaction often touches many micro‑services or databases. Traditional ACID transactions guarantee atomicity only within a…
Eventual consistency — Motivation In a distributed system, data is often replicated across multiple nodes (databases, caches, micro‑services). When a client updates data, that update must be propagated…
Strong Consistency — In a distributed backend, data is often replicated across multiple nodes or services. When a client writes a value, that write must be visible to all subsequent reads, no matter…
Vector clocks — Why it matters When you build multi‑master databases, CRDT‑based collaboration tools, or event‑sourced services that run on multiple replicas, you need a lightweight mechanism to…
Logical clocks — Imagine each node is a book that writes its own page numbers. When you read a page, you can tell if it was written before or after another page by comparing numbers, even if the…
Network Partitions — Motivation In a distributed system, nodes communicate over a network that can become unreliable. A network partition happens when a subset of nodes can no longer reach another…
Split brain — In a distributed system, multiple nodes cooperate to provide a single logical service (e.g., a database cluster, a cache cluster, or a microservice that needs high availability)…
Clock Synchronization — If you ignore clock synchronization, you risk subtle bugs that surface only under load or after a few hours of operation. In production, this can lead to data loss, security…
Gossip protocols — Motivation In a distributed system you often need to keep many nodes in sync – e.g., a cluster of cache servers, a set of micro‑services that share a feature flag, or a group of…
Quorum — Motivation In a distributed system you often have multiple replicas of data or services. When a client asks for a value or performs an update, you need a single, consistent answer…
Replication strategies — Analogy: Think of a library that keeps a copy of every book in three branches. If one branch closes, the other two still have the books. Readers can go to any branch, and the…