Why Distributed Systems Are Hard

Topics Covered

What Makes a System Distributed

Why we distribute at all

The network sits inside every operation

Nodes, messages and state

Examples you already use

What this course gives you

Shared memory versus message passing

Coordination has a cost

Throughput, latency and fault tolerance pull apart

A vocabulary for the rest of the course

Partial Failure

Silence is ambiguous

Failure detection is a guess

Gray failure

Failures are normal at scale

Correlated failure

Designing for partial failure

Crash, omission and worse

Recovery is part of failure

The human side of partial failure

The Network Is Not Reliable

Loss, delay, duplication and reordering

Unbounded delay

Network partitions

The end to end argument

Bandwidth, latency and the speed of light

What retries and queues do to a network

Partitions inside a single data center

Testing against a hostile network

Designing protocols for a lossy network

No Global Clock and No Global View

Clocks disagree

Why order matters

Every view is a view of the past

Knowledge and truth

Snapshots without a global clock

Order is relative to observers

Living with staleness

Causality is what really matters

Timeouts depend on clocks too

Thinking Like a Distributed Systems Engineer

The fallacies of distributed computing

Ask what happens at each step

Tail latency at scale

Every design is a tradeoff

Simplicity as a strategy

How this shows up in interviews

A mental checklist

Make operations safe to repeat

Prefer explicit state machines

Measure what the user sees

Write down the guarantees

A distributed system is a group of computers that work together on one job and coordinate only by sending messages over a network. Each computer, usually called a node or a process, has its own memory, its own clock and its own view of the world. No node can read the memory of another node directly. Everything one node knows about another arrived in a message, and every message can be late, lost, duplicated or delivered out of order. This lesson explains why that single fact makes distributed systems so much harder than programs on one machine, and it introduces the vocabulary the rest of the course builds on.

Why we distribute at all

Nobody builds a distributed system for fun. Teams distribute because one machine stops being enough. The first reason is scale: the data no longer fits on one disk, or the traffic needs more CPU than one server has. The second is availability: a single machine eventually fails, and a service that must stay up through hardware faults, kernel upgrades and data center outages needs copies of its state in more than one place. The third is latency: users in Tokyo should not wait for a round trip to Virginia, so data and compute move closer to them. The fourth is organizational: large companies split systems into services owned by separate teams, and those services talk over a network even when they could have shared one machine.

Each reason pushes state and work onto more machines, and each new machine adds new ways for the whole system to be wrong.

The network sits inside every operation

On one machine, a function call either returns or the whole program crashes. The caller and the callee share a fate. In a distributed system, a call to another node is a message sent into the network, followed by a wait for a reply. The network becomes part of every operation, with its own failure modes. It can delay the request, drop it, deliver it twice or deliver it after a later request. The remote node can be slow, overloaded, paused for garbage collection or dead. The caller sees only one thing: either a reply arrives within its patience, or it does not.

This is the shift that makes distributed systems a field of its own. Local reasoning assumes that steps happen in a known order and that failure is total. Distributed reasoning has to cope with steps that happen in an unknown order and failures that are partial.

Once state moves onto separate machines, every operation becomes messages over a network that can delay or lose them.

Nodes, messages and state

Throughout this course, a node is any process that holds state and runs a program: a database replica, a queue broker, a cache server, a microservice instance. A message is any unit of communication between nodes: an RPC request, a reply, a replication record, a heartbeat. State is whatever a node remembers between messages, in memory or on disk. A distributed algorithm is a set of rules each node follows when it receives a message or a timer fires, chosen so that the nodes together achieve some goal, such as agreeing on a value or keeping copies of data the same.

Two properties describe almost every goal. A safety property says that something bad never happens: two nodes never both believe they are the leader, a committed write is never lost, a read never returns a value that was never written. A liveness property says that something good eventually happens: a request eventually gets a reply, a new leader is eventually elected. Much of the art in this field is keeping safety unconditional while accepting that liveness may stall during bad periods.

Examples you already use

You already depend on distributed systems every day. A replicated database such as PostgreSQL with streaming replicas keeps copies of data on several machines. A coordination service such as ZooKeeper or etcd runs a consensus protocol so that a handful of nodes agree on configuration and leadership. A log such as Kafka replicates partitions across brokers. A key value store such as Cassandra or DynamoDB spreads data across many nodes and lets the client choose how many must answer. A content delivery network keeps cached copies at the edge. Each of these systems is a specific set of answers to the questions this course covers: how to order events, how to copy data, how to agree, and what to promise clients when things go wrong.

What this course gives you

Interviews for senior backend and infrastructure roles probe this material directly. A system design answer that says the database is replicated invites the follow up questions: synchronously or asynchronously, what happens on failover, can a client read its own write, what happens during a network partition. Production incidents probe it too, usually at three in the morning. The aim of this course is that you can answer those questions from first principles rather than from memory of one product.

Shared memory versus message passing

It is worth being precise about the boundary. Threads on one machine also run concurrently, and concurrency bugs are hard. But threads share memory, a single clock and a single failure domain. When the machine dies, every thread dies with it. Distributed nodes share nothing: no memory, no clock and no fate. That is why a lock on one machine is a few nanoseconds of atomic instructions, while a lock across machines needs leases, fencing tokens and a consensus service, as a later lesson shows.

Coordination has a cost

Every time nodes must agree on something before answering, the answer waits for messages. A write that must reach three replicas before it is acknowledged waits for the slowest of the needed replies. A lock that must be granted by a coordination service adds a round trip before the protected work can start. A read that must confirm it sees the latest value has to ask a majority. These costs are not bugs to optimize away. They are the price of the guarantees, and the price grows with distance between nodes and with the number of nodes that must take part.

This is why much of distributed systems design is about deciding where coordination is truly needed. Counting page views does not need every node to agree on the exact count at every instant. Deducting money from an account does. A good design spends coordination only where the product requires it and lets the rest run independently.

Throughput, latency and fault tolerance pull apart

Three goals come up in almost every design discussion, and they compete. Throughput improves when work is split across more nodes that do not wait for each other. Latency improves when each request touches as few nodes as possible, ideally ones close to the user. Fault tolerance improves when each piece of state lives on several nodes and changes are confirmed by more than one. Adding replicas helps fault tolerance and read throughput but slows writes. Adding shards helps throughput but makes operations that span shards slower and harder. Knowing which goal a product cares about most is the first step in choosing a design.

A vocabulary for the rest of the course

A few more terms recur. A replica is a copy of some data on a node. A shard or partition, in the data sense, is a slice of the data held by a subset of nodes. A leader is a node that orders operations for some data, and followers apply operations in the order the leader chose. A quorum is a subset of nodes large enough that any two such subsets overlap, usually a majority. A term or epoch is a number that increases each time leadership changes, so that messages from an old leader can be recognized. Each of these terms gets its own lesson later.

The network is part of the program

A distributed system coordinates only by messages, so every remote call can be delayed, lost, duplicated or reordered, and every node can fail on its own. Describe goals as safety properties that must always hold and liveness properties that should eventually hold.

On a single computer, failures tend to be total. If the power supply dies, everything stops. If the kernel panics, every process stops. A program can mostly assume that if it is running, the machine under it is working. Distributed systems lose that assumption. At any moment some nodes are fine, some are dead, some are slow and some are cut off from the others, and the nodes that are fine usually cannot tell which of the others is which. This condition is called partial failure, and it is the root of nearly every hard problem in the field.

Silence is ambiguous

Suppose node A sends a request to node B and no reply comes back. There are many possible explanations. The request may have been lost in the network before reaching B. B may have crashed before processing it. B may have processed it and crashed before replying. B may have processed it and replied, and the reply was lost. B may be alive but paused for a long garbage collection, and the reply will arrive in ten seconds. The network may be congested, and both messages are sitting in a queue on some switch.

From the point of view of A, all of these look exactly the same: silence. A cannot distinguish a dead node from a slow one, and it cannot tell whether its request took effect. This is the central uncertainty of distributed computing. Every protocol in this course is, in part, a way of acting sensibly without ever resolving it.

A client that hears nothing cannot tell a lost request from a crashed server or a lost reply.

Failure detection is a guess

Since nothing in the network announces that a node is dead, systems detect failure by waiting. A node that has not replied within some timeout is suspected to have failed. This is a guess, and it can be wrong in both directions. A short timeout declares healthy but slow nodes dead, which triggers needless failovers and can make overload worse, because the work of a node declared dead is moved onto nodes that are already busy. A long timeout leaves clients waiting on a node that really has died. No timeout is correct, only more or less suited to the network and the cost of each kind of mistake.

The consequence is profound. Any algorithm that assumes it can accurately detect failures is broken, because it will sooner or later act on a false suspicion. Well designed protocols treat the output of a failure detector as a hint: they act on it to make progress, but they stay safe even when it is wrong. Raft, for instance, starts an election when a follower stops hearing from the leader, but its voting rules guarantee that a falsely suspected leader cannot cause two leaders in the same term.

Gray failure

Real failures are often not clean crashes. A node may answer health checks while failing real requests, because the health check exercises a different code path. A disk may be slow rather than dead, so every write succeeds after two seconds. A network card may drop one packet in a hundred. A process may leak memory and pause for longer and longer collections. Researchers call these gray failures: the system is degraded in a way that some observers see and others do not. A load balancer sees a healthy node while users see timeouts. Gray failures are among the most common causes of large outages, because the automated recovery machinery does not notice them.

Failures are normal at scale

On one machine, a hardware failure is a rare event. In a fleet of ten thousand machines, it is a daily one. If each disk fails on average once every few years, a fleet with tens of thousands of disks loses several every day. Large operators therefore treat failure as routine: they design systems that keep working while some fraction of nodes are always down, and they practice failure on purpose with chaos experiments. The goal is not to prevent every failure but to make each one boring.

Correlated failure

Copies only help if they do not fail together. Two replicas on the same rack share a power supply and a top of rack switch. Two replicas in the same availability zone share a building and a cooling system. Two replicas running the same software version share every bug, and a bad configuration push can take down every copy at once. Much of practical reliability engineering is about spreading copies across independent failure domains and rolling out changes gradually, so that one fault cannot reach every replica in the same minute.

Replicas that share a rack, a zone or a software version can fail together, which defeats the point of copying.

Designing for partial failure

A few habits follow from all of this. Every remote call needs a timeout, because without one a single stuck node can hold threads forever and spread the failure upward. Every remote call that might be retried needs to be safe to repeat, which the timeouts lesson covers in depth. Every component should degrade rather than collapse: serve stale data, shed load or return a partial result rather than hang. And every protocol should be judged by asking, for each step, what happens if this node dies right here, or this message never arrives, or arrives twice.

That question, asked relentlessly at each step, is the core skill of distributed systems design. Interviewers often probe for it by describing a protocol and asking what happens if a specific node crashes at a specific moment.

Crash, omission and worse

It helps to name kinds of failure precisely. A crash failure means a node stops and never sends another message. A crash recovery failure means it stops and later restarts, possibly with whatever it had written to disk but nothing that was only in memory. An omission failure means it silently drops some messages it should have sent or received. A timing failure means it responds, but too late to be useful. A Byzantine failure means it behaves arbitrarily, sending wrong or contradictory messages, whether from a bug, corrupted memory or an attacker. The next lesson turns these into formal system models, because the failures you assume decide which algorithms are possible.

Recovery is part of failure

A node that crashes and restarts is in some ways more dangerous than one that stays dead. It may come back with an old view of the world: it believes it is still the leader, or that a lease it held is still valid, or that a write it buffered in memory is safe. If the rest of the system moved on while it was down, its stale beliefs can corrupt data. Protocols therefore make restarting nodes check in before acting: re-read the current term, ask who the leader is, and discard any state that was not durably written. Writing important state to disk before acknowledging it, and reloading it on restart, is how systems make crash recovery safe.

The human side of partial failure

Partial failure also confuses the people operating a system. A dashboard shows most nodes green. Users report errors. An engineer restarts the node that looks unhealthy, which moves load onto the others and makes the problem worse. Good operational practice treats partial failure as expected: dashboards that show errors from the user side rather than only health checks, runbooks that ask what changed before restarting anything, and automated recovery that is rate limited so it cannot take down healthy capacity in a rush.

You cannot tell slow from dead

When a reply does not arrive, the cause could be a lost request, a crashed node, a lost reply or a slow node, and the caller cannot tell which. Treat failure detection as a guess, keep safety intact when the guess is wrong, watch for gray failures and spread replicas across independent failure domains.

Most networks inside data centers are packet switched and asynchronous. Messages are split into packets, each packet travels through switches with queues, and the network makes no promise about when, or whether, a packet arrives. TCP hides some of this by retransmitting lost packets and delivering bytes in order on one connection, but it cannot hide everything. It cannot deliver across a cut cable, it cannot bound delay, and it cannot tell the application whether a message it sent was processed by the remote program. This section walks through what the network can do to a message and what that means for the programs on either end.

Loss, delay, duplication and reordering

Four things can happen to a message besides arriving promptly. It can be lost, because a switch buffer overflowed, a cable was unplugged or a process crashed before reading its socket. It can be delayed by an amount with no fixed upper bound, because queues fill under load and retransmission timers back off. It can be duplicated, usually not by the network itself but by a sender that retries after a timeout when the original was only delayed. And it can be reordered relative to other messages, because separate connections, separate paths and retries do not respect the order in which the application sent things.

TCP gives order and deduplication within one connection. But connections break and are re-established, clients talk to several servers, and requests go through load balancers and proxies. As soon as two messages travel on different connections, their order is no longer guaranteed.

When two messages take different paths or a retry, the later one can arrive first and leave the receiver with the older value.

Unbounded delay

The most important property of an asynchronous network is that delay has no upper bound. A message usually arrives in half a millisecond inside a data center, but occasionally it takes a hundred milliseconds, and very occasionally several seconds, when a switch is congested or a link fails over. This long tail exists in every real network. It means that no matter how long a node waits, it cannot be sure the message is not still on its way. A timeout is not a fact about the message; it is a decision about how long to wait before acting as if the message is gone.

Delay comes from many layers beyond the wire: the send queue in the kernel of the sender, every switch queue along the path, the receive queue at the far end, the scheduler deciding when the receiving thread runs, and the queue inside the application itself of pending requests. Under load, the queues dominate. That is why latency explodes as utilization approaches one hundred percent, and why overload looks exactly like network failure to the nodes on either side.

Network partitions

A network partition is a fault where some nodes can talk among themselves but not with others. The cause may be a failed switch, a misconfigured firewall rule, a cut fiber between data centers, or a routing change. Partitions are not rare. Studies of production networks at large companies found partition events many times per year, and cloud providers publish incident reports of zone or region connectivity loss regularly. Partitions are also sometimes asymmetric: A can reach B, but B cannot reach A, or both can reach C while not reaching each other.

What makes partitions dangerous is that every node on each side keeps running. Clients on each side keep sending requests. If both sides keep accepting writes to the same data, the copies diverge, and when the partition heals someone has to reconcile them. If one side stops accepting writes, its clients see errors. Every replicated system has to choose, for each operation, which of those outcomes it prefers. The lesson on CAP and PACELC examines that choice precisely.

During a partition every node keeps running, but each side sees the other as dead, and clients on both sides keep sending requests.

The end to end argument

Because the network can lose or duplicate messages at many layers, reliability built into one layer does not make the whole path reliable. A TCP acknowledgment means the remote kernel received the bytes, not that the application processed them, wrote them to disk or acted on them. The end to end argument, a classic principle of system design, says that guarantees such as exactly once processing or durable delivery can only be fully provided by the endpoints themselves, with application level identifiers, acknowledgments and checks. Lower layers can help performance but cannot replace those checks.

In practice this means a payment service cannot rely on TCP to avoid charging twice. It needs an application level request identifier that it records with the charge, so that a duplicate request with the same identifier is recognized and ignored. The next lessons build on exactly that idea.

Bandwidth, latency and the speed of light

Not every network problem is a failure. Even a perfect network has latency set by physics. Light in fiber travels about two hundred kilometers per millisecond, so a round trip between the east and west coasts of the United States takes at least sixty milliseconds, and between continents often more than one hundred and fifty. Any protocol that needs a round trip between regions before it acknowledges a write pays that cost on every write. This is why globally consistent databases are slower to write than regional ones, and why many systems choose weaker guarantees across regions.

What retries and queues do to a network

When a service slows down, its clients time out and retry. Each retry adds load to a service that was already struggling, which slows it further, which triggers more retries. This positive feedback loop, often called a retry storm, can turn a short blip into a long outage. The same effect happens with queues: a queue that grows faster than it drains holds requests whose callers have already given up, so the service spends its capacity on work nobody is waiting for. The timeouts lesson covers the standard defenses: retry budgets, exponential backoff with jitter, deadlines that travel with each request and load shedding at the server.

Partitions inside a single data center

It is tempting to think partitions happen only between distant sites. In fact many happen inside one data center. A top of rack switch fails and isolates a rack. A software bug in a network device drops traffic for some flows but not others. A security group or firewall rule is changed and blocks one port. A host network interface hangs. A container network overlay misbehaves on one host. Any of these splits nodes that sit a few meters apart, and to the software the effect is the same as a cut cable between continents.

Testing against a hostile network

Because these failures are rare on any one machine but common across a fleet, ordinary testing rarely triggers them. Teams that build distributed systems therefore inject network faults on purpose. Tools can drop, delay, duplicate and reorder packets between chosen nodes, or block traffic entirely to create a partition, while a test workload checks that the system keeps its promises. The final lesson of the course covers this practice, including the Jepsen style testing that has found consistency bugs in many well known databases. For now, the lesson is that an untested failure path should be assumed broken.

Designing protocols for a lossy network

Protocols that work on unreliable networks share a few patterns. Every request carries an identifier so that duplicates can be detected. Every important message is acknowledged at the application level, and the sender keeps retrying until it sees the acknowledgment or gives up deliberately. Receivers process messages so that a repeated message is harmless. State changes carry version numbers so that an old message arriving late cannot overwrite newer state. And no step assumes that a message arrived just because it was sent. These patterns appear in every protocol later in the course, from replication streams to Raft.

Assume every message can misbehave

Design for loss, unbounded delay, duplication and reordering, and remember that TCP order holds only within one connection. Partitions happen many times a year, leave both sides running and force a choice between divergence and unavailability. Exactly once effects need end to end identifiers at the application.

The second deep difficulty, after partial failure, is that distributed nodes share no notion of now. Each node has its own clock, and those clocks drift apart, jump when they are corrected and can even run backward. There is no global clock that every node can read to decide which of two events happened first. And because every piece of information about other nodes travels by message, the picture each node holds of the system is a picture of the past, already out of date by the time it arrives.

Clocks disagree

The quartz oscillators in server clocks drift by tens of parts per million, which adds up to a few milliseconds per minute if nothing corrects them. Time synchronization protocols such as NTP pull clocks back toward a reference, but they work over the same unreliable network, so accuracy is typically a few milliseconds inside a data center and worse across the internet. When a clock is corrected, it may jump forward or backward. Virtual machines can pause for seconds while the host does other work, then resume with a clock that suddenly leaps ahead.

The result is that timestamps from different nodes are not comparable at fine grain. If node A records an event at 12.000 seconds past the minute and node B records another at 11.998, you cannot conclude that the event on B came first. The difference is smaller than the uncertainty of the clocks. Worse, a message sent by A can be stamped by B with an earlier time than A stamped it when sending, so the effect appears to come before its cause.

With unsynchronized clocks, a node can stamp an event that a message caused with an earlier time than the message itself.

Why order matters

Ordering looks like a detail until you see what depends on it. A replicated database must apply writes in the same order on every copy, or the copies end up with different values. A system that resolves conflicting writes by keeping the latest one silently drops data when the clock that called it latest was wrong. A distributed lock that expires after ten seconds is only safe if the holder and the lock service agree on how long ten seconds is. A debugging session that merges logs from several nodes is misleading if their timestamps are skewed.

The course spends a whole section on time and order. Lamport clocks give a consistent order to events without trusting physical time. Vector clocks capture exactly which events could have influenced which others. Hybrid logical clocks and Google TrueTime combine physical and logical time to get timestamps that are both meaningful and safe.

Every view is a view of the past

Because information travels by message, a node never sees the current state of another node, only the state at the moment the message was sent. If B asks A for the value of a key and A answers 7, the value may have changed by the time B reads the reply. If a monitoring node collects status from a hundred nodes, its dashboard mixes states from slightly different moments. No node can take an instantaneous snapshot of the whole system.

This matters for any decision that depends on global state. Is the cluster healthy? How many replicas have this write? Who is the leader right now? Each answer is assembled from messages that were sent at different times, and some of them may already be wrong. Distributed algorithms make decisions that stay correct even though the inputs are stale, typically by tagging information with version numbers, terms or epochs so that old information can be recognized and discarded.

Knowledge and truth

A useful way to think about this is the difference between what is true and what a node knows. It may be true that the leader has crashed, while no follower knows it yet. It may be true that a write is stored on three replicas, while the client that sent it knows only that one replied. Protocols are designed around knowledge, not truth: a leader can only commit an entry once it knows a majority has it, and a follower can only start an election once it believes, from its own evidence, that the leader is gone. Reasoning in terms of who knows what, and when they learned it, makes many protocol rules suddenly obvious.

A reply describes the sender at the moment it was sent, and the sender may have changed by the time the reply lands.

Snapshots without a global clock

If no node can see the whole system at one instant, how do systems take consistent backups or detect that a computation has finished? The answer is that a snapshot does not need to be simultaneous; it needs to be consistent, meaning that if it records the receipt of a message, it also records the sending of that message. The Chandy and Lamport snapshot algorithm achieves this by having each node record its state when it first sees a special marker message and record messages that arrive on each channel until the marker arrives on that channel. The result is a picture of a state the system could have been in, even though no node ever saw it all at once.

Order is relative to observers

Another consequence of having no global clock is that two observers can disagree about the order of events and both be right according to the information they had. If A and B each send a message to C and to D, C may receive A first while D receives B first. Neither is wrong; the events at A and B were concurrent, meaning neither could have influenced the other. Systems that need every observer to see the same order, such as replicated logs, must create that order explicitly, usually through a leader or a consensus protocol. Systems that can tolerate different observers seeing different orders can avoid that coordination.

Living with staleness

Staleness is not always a problem. A product catalog that is a few seconds behind is fine. A social feed that is a minute behind is fine. A bank balance that lets a customer withdraw the same money twice is not. The skill is to identify, for each piece of data and each read, how stale an answer may be before it causes harm, and then to pick a replication and read strategy that bounds staleness to that level. Later lessons give names to these choices, such as read your writes, monotonic reads and bounded staleness.

Causality is what really matters

When engineers say they need events in order, they usually mean something more specific: if one event could have caused another, every node should see them in that order. A reply should never appear before the question. A comment should never appear before the post it replies to. Events that could not have influenced each other, because neither node had heard of the other event when it happened, can appear in either order without harm. This relation, called happens before, was defined by Leslie Lamport in 1978, and it is the foundation of the clocks section. It captures what physical time was being used to approximate, and it can be tracked exactly with messages alone.

Timeouts depend on clocks too

Even a single node uses time in ways that matter. A lease that lasts ten seconds is measured on the holder clock and on the server clock, and if one of them pauses or runs fast, they disagree about when the lease ends. A timeout that should fire after two seconds may fire late if the process was paused. Systems that depend on time for safety must use monotonic clocks for durations, which only move forward, and must leave a margin for drift and pauses. The leases lesson shows how fencing tokens remove the need to trust time at all for the most dangerous cases.

Reason about knowledge, not truth

Clocks on different nodes drift and jump, so physical timestamps cannot order events reliably, and every message describes the sender at the time it was sent. Design protocols around what each node knows, and attach versions, terms or epochs so stale information can be recognized and ignored.

The previous sections describe what can go wrong. This one describes how experienced engineers think about it, because the same handful of habits separates designs that survive production from designs that work only in demos. It covers the classic fallacies of distributed computing, the habit of asking what happens at each step if something fails, how tail latency grows as systems fan out, and the tradeoffs that every design in the rest of the course makes in some form.

The fallacies of distributed computing

In the 1990s, engineers at Sun Microsystems listed assumptions that newcomers to distributed systems make and later regret. The network is reliable. Latency is zero. Bandwidth is infinite. The network is secure. Topology does not change. There is one administrator. Transport cost is zero. The network is homogeneous. Every one of these is false, and every one has caused real outages. A design review that checks a proposal against the list catches a surprising number of problems: a service that assumes a call to its neighbor is free, a protocol that assumes the address of the leader never changes, a client that assumes a request either succeeds or fails cleanly.

Ask what happens at each step

The most useful habit is to walk through a protocol one step at a time and ask, at each step, what happens if this node crashes right now, if this message is lost, if it is duplicated, or if it arrives very late. Take a simple transfer between two accounts held on two services: debit A, then credit B. If the process crashes after the debit and before the credit, money disappears. If the credit request is retried after a timeout, money may appear twice. Each answer forces a design decision: a durable record of the progress of the transfer, an idempotent credit, a recovery process that finishes or reverses half done transfers. The transactions lesson turns these decisions into two phase commit and sagas.

Tail latency at scale

When one request fans out to many servers and must wait for all of them, its latency is the latency of the slowest one. If each server is fast ninety nine percent of the time and slow one percent of the time, a request that touches one server is slow one percent of the time. A request that touches a hundred servers is slow most of the time, because the chance that all hundred are fast is only about thirty seven percent. This is the tail at scale effect, and it is why large systems care so much about the ninety ninth and ninety ninth point nine percentiles rather than averages. Remedies include hedged requests that send a backup copy after a short delay, reducing fan out, and isolating slow nodes quickly.

A request that must wait for every server it fans out to is as slow as the slowest one, so rare slowness becomes common.

Every design is a tradeoff

The rest of the course is a tour of tradeoffs that cannot be escaped, only chosen deliberately. Stronger consistency costs latency and availability during partitions. More replicas cost more coordination per write. Synchronous replication protects against data loss but makes every write wait for the slowest replica. Consensus gives a single agreed order but needs a majority of nodes reachable to make progress. Coordination free designs such as CRDTs stay available everywhere but limit what operations you can express. A strong engineer names the tradeoff, chooses based on what the product needs, and states what the system will do when the bad case happens.

Simplicity as a strategy

Because distributed protocols are so easy to get wrong, the best designs often avoid distribution where they can. A single leader that orders all writes is easier to reason about than many leaders that must merge. A managed coordination service is safer than a homegrown election algorithm. Keeping related data on the same shard avoids distributed transactions entirely. Senior engineers reach for the simplest design that meets the requirements and add distributed machinery only when a requirement forces it, and they can explain which requirement that was.

How this shows up in interviews

System design interviews at senior levels expect candidates to raise these issues without being asked. When you add a cache, say how it is invalidated and what readers see in the meantime. When you replicate, say whether it is synchronous and what happens on failover. When you call another service, say what the timeout is and whether the call is safe to retry. When you shard, say what happens to cross shard operations. Interviewers notice candidates who treat the network as reliable, and they notice candidates who ask what happens when it is not.

A mental checklist

A compact checklist covers most of the ground. What is the source of truth for each piece of state? How is it replicated, and how far behind can a copy be? What does a client see during a failover or a partition? What happens if any message is lost, duplicated or delayed? How are failures detected, and what happens when the detector is wrong? Which operations need coordination, and can any be made coordination free? What is measured to know the system is healthy? Each question maps to one or more lessons ahead.

Make operations safe to repeat

One habit pays off more than any other: design every operation that crosses a network so that doing it twice has the same effect as doing it once. Setting a value is naturally idempotent; adding to it is not. Creating an order with a client chosen identifier is idempotent if the server refuses duplicates; creating an order with a server chosen identifier is not. When operations are idempotent, retries become safe, recovery jobs can replay work without fear, and many of the hardest failure cases simply disappear. When they are not, every retry is a bet.

Prefer explicit state machines

Another strong habit is to model each long running operation as an explicit state machine stored durably: pending, reserved, charged, shipped, cancelled. Each transition happens only after the previous state is recorded, and a recovery process can look at any record and know exactly what to do next. This turns the vague question of what happens if the process crashes here into a precise one with a written answer for each state. Workflow engines and the saga pattern are built on this idea.

Measure what the user sees

Finally, experienced engineers measure distributed systems from the outside as well as the inside. Each node can report healthy while users suffer, because of gray failures, partitions between the client and the service, or slow dependencies. End to end probes that act like users, error rates measured at the edge and latency percentiles for whole requests reveal the problems that per node metrics miss. When numbers disagree, trust the user facing measurement and work inward to find the cause.

Write down the guarantees

Most confusion in distributed systems comes from guarantees that were never stated. Before building, write down for each operation what the system promises: is an acknowledged write durable against one node failure, or two? Can a client read its own writes immediately? What happens to requests during a failover, and how long can a failover take? What does a client see during a partition? When these promises are written, design reviews can check the mechanism against them, tests can verify them and users can rely on them. When they are not, every team assumes a different answer and discovers the difference during an incident.

What good looks like at each level

A junior engineer knows that networks lose and delay messages, puts timeouts on every remote call and recognizes that a timeout does not prove failure. A mid level engineer walks a protocol step by step to find crash and duplicate cases, designs idempotent operations and spreads replicas across failure domains. A senior engineer states the consistency and availability tradeoff of each design up front, reasons about knowledge and staleness with versions and terms, manages tail latency in fan out paths and keeps distribution out of designs that do not need it.