Distributed systems · L1Why distributed systems are hard

Why distributed systems are hard

Once your system runs on two or more machines, parts fail on their own, messages get lost and clocks disagree. Learn what changes and where each problem is solved.

L1 Must-knowDistributed systems16 min read
Fact-checked by AI against cited sources · Human review pendingLast reviewed 22 Oct 2026 · How we check content
Section 1 of 8

What broke

January 4th, 2021 was the first working day of the year for many people. Slack's traffic jumped. Client caches were cold, so apps pulled down more data than usual on their first connection. 1

Slack's networks on AWS were linked by Transit Gateways. Under the new load, these gateways did not scale fast enough. Part of the network "had indeed become saturated and was dropping packets". 1

The problem was in the network between the servers. Many calls between them were slow or lost. At 6:57 AM PST, about 99% of messages were sent. On a normal day the rate is above 99.999%. 1

Then the tools for seeing the problem broke too. The dashboards and alerts ran in a different network from their databases. So they also needed the broken gateways, and they failed. 1

The machines also read the signs wrong. Threads spent more time waiting on the network, so CPU use dropped. Autoscaling saw low CPU and removed servers. Later, as waiting threads piled up, the team tried to add 1,200 servers between 7:01 and 7:15 AM. That hit other limits. Health checks also failed at a very high rate. The load balancers have a "panic mode" for this: they spread requests across all servers anyway. That, with retries and circuit breakers, got traffic flowing again. 1

No single machine broke. Some parts worked, some failed, and the automatic tools read the signs wrong. AWS raised the gateway capacity by hand, and the network was normal again by 10:40 AM PST. 1 This is what distributed systems feel like.

Section 2 of 8

The idea in simple words

A system is distributed when it runs on more than one machine and the machines talk over a network. Your app server and its database on another host already count. So does a phone app that calls your API.

On one computer, if a part fails, you usually expect the whole computer to stop. In a distributed system, one node can crash while the others keep working. Kleppmann calls this a partial failure. 2 Faults in the network or a node can happen at any moment, with no warning. 2

Partial failure comes with other hard problems:

  • The network can lose, delay, duplicate or reorder messages.
  • A caller cannot tell a slow server from a dead one.
  • There is no shared clock that all machines agree on.

The key idea. In a distributed system, "I got no answer" does not mean "it did not happen". Design every call so that the caller can live with not knowing.

Section 3 of 8

How it works

One call, many places to fail

Gabrielson, from AWS, splits one request and reply into eight steps. The client sends the request, the network delivers it, the server checks it and updates its state. Then the same happens in reverse for the reply. 3 Any of the eight steps can fail. The client, the server and the network fail independently of each other. 3

Step through what the caller sees when no reply comes. Use Next and Back, or the ← and → keys.

No reply: four different causes look the same to the caller Order app Stock service reserve item?no reply · 2 s A · the request is lost B · the server crashedserver is down C · the server is slowbusy · 30 sreply comes too late D · the reply is lostreserved The app sees the same in A, B, C and D SeniorPath
  1. The order app asks the stock service to reserve one item. After 2 seconds there is still no reply. What happened?
  2. Cause A. The network lost the request. The stock service never saw it, so nothing was reserved.
  3. Cause B. The request arrived, but the stock service crashed. Maybe it reserved the item first, maybe not.
  4. Cause C. The stock service is alive but slow, for example in a long garbage collection pause. The reply will come, but after the app stopped waiting.
  5. Cause D. The stock service reserved the item and replied. The network lost the reply. The work is done, but the app does not know.
  6. From the app's side, all four cases look the same: silence. It cannot tell a lost message from a slow or dead server. So a retry must be safe in every case.
Step 1 of 6

When the client times out, the result is UNKNOWN: the work "may or may not have happened". 3 Kleppmann gives the classic example. If a client resends a request after no reply, the server may do it twice, such as charging a credit card twice. 2

The network is unreliable

Messages can be lost, delayed, duplicated and reordered. 2 TCP retries lost packets and removes duplicates for you. But TCP usually gives up after a timeout, typically about a minute. If a network split lasts longer, your code needs its own retries and duplicate checks. 2

Delays can be huge. Kleppmann notes documented cases where packets inside one data center were delayed for more than a minute. 2

You cannot tell slow from dead

The usual way to spot a dead server is a timeout: send a message and wait for a reply. But silence can also mean that the message was lost or delayed. 2 The server may also be paused. Stop-the-world garbage collection in languages such as Java can pause all threads, and on large heaps the pause can last several minutes. 2

So a timeout is a guess. Too short, and you mark healthy servers as dead. Too long, and users wait on a server that is gone. In Slack's outage, low CPU looked like low load, but it really meant threads were waiting on the network. 1

There is no shared clock

Each machine has its own clock, usually a quartz crystal. Some run a bit fast and some a bit slow, and their speed changes with temperature. 2 Machines sync their clocks over the network, but the network adds its own error. 2 So two machines can disagree on "now", and timestamps from different machines may not show the true order of events.

The eight fallacies

These problems are old. According to Rotem-Gal-Oz, Peter Deutsch, then a Sun fellow, wrote down seven false assumptions in 1994. James Gosling added an eighth in 1997. 4 Designers often assume:

  1. The network is reliable.
  2. Latency is zero.
  3. Bandwidth is infinite.
  4. The network is secure.
  5. Topology doesn't change.
  6. There is one administrator.
  7. Transport cost is zero.
  8. The network is homogeneous.

Each one feels true on your laptop. Each one is false in production. For the first one, Rotem-Gal-Oz says you must plan for lost calls: retry, acknowledge important messages, and ignore duplicates or make messages idempotent. 4

Where each problem is solved

This lesson is a map. Each problem has its own lesson:

Section 4 of 8

Trade-offs

When a call gets no reply, you must choose what to do. Each choice has a cost.

ChoiceSafe if the first call worked?User waits?Use it when
Short timeout, then retryNo , unless the call is idempotent.No Fast failover.Reads, or writes with an idempotency key.
Long timeoutYes You do not resend.Yes A dead server holds users for the full time.Slow but rare work, such as a big report.
Fail and show an errorYes , but the work may still have happened.No The user can safely try again later.
Check the status laterYes You ask "did order 42 go through?"Some. Needs a status API.Payments and other money moves.
Hand it to a queueYes , if consumers drop duplicates.No The work is done in the background.Work that does not need an answer now.

Simple rule (our advice): every remote call needs a timeout, and every retry needs a way to drop duplicates.

Section 5 of 8

At work: how a senior uses this

  • In design reviews, point at each arrow between two boxes and ask: "What happens if this call is lost, slow or done twice?"
  • Check that every network call has a timeout you chose on purpose. Do not trust the client library's default; look it up.
  • Treat a timeout as "unknown", not "failed". Log it as unknown, and reconcile later if money or stock is involved.
  • Keep monitoring away from the thing it monitors. Slack's dashboards failed because they needed the same broken network. 1
  • Be careful with automatic actions based on one signal, such as CPU. A stuck system can look idle.
  • Test failure, not just success. Gabrielson writes that engineers must assume each step of a call could fail. 3 He also warns that distributed bugs often show up long after they are deployed. 3
  • When you add a new service, list which of the eight fallacies it depends on.
Section 6 of 8

With AI

What to ask the agent

"List every network call in this code path. For each one, show the timeout, the retry rule, and whether the call is safe to repeat. Mark any call with no timeout."

"This handler calls the payment service and then saves the order. Walk through what happens if the payment call times out but the payment really worked."

"Write a test that makes the stock service reply after 5 seconds, and one where the reply is lost after the work is done. Show what our code does in each case."

What to check yourself

  • The agent did not treat a timeout as "the call failed". Look for code that undoes work it is not sure about.
  • Retries reuse the same request ID or idempotency key. They do not make a new one each time.
  • Timeouts are set in the real client config, not only in comments or docs.
  • No logic compares timestamps from two different machines to decide which event came first.
  • Tests cover a lost reply, not just a lost request. A lost reply is the case where the work was really done.
Section 7 of 8

Check yourself

1. Your service calls another service and gets no reply within the timeout. What do you know?

Show answer

Nothing for sure. The request may or may not have been done. The request could be lost, the server could be dead or slow, or the reply could be lost. From the caller's side these look the same.

2. What is a partial failure?

Show answer

Some parts of the system fail while other parts keep working. On one computer, a fault usually stops everything. In a distributed system, one node or link can fail while the rest keep running.

3. Why is it risky to retry a "charge card" call that timed out?

Show answer

The first call may have worked, so a retry can charge the card twice. A timeout means the result is unknown. Make the call safe to repeat, for example with an idempotency key.

4. In Slack's January 2021 outage, why did autoscaling first remove servers?

Show answer

Threads were waiting on the slow network, so CPU use dropped and looked like low load. The postmortem says waiting threads lowered CPU use, which first started some automatic downscaling.

5. Which of these is one of the eight fallacies of distributed computing?

Show answer

The network is reliable. "The network is reliable" is the first fallacy. The others include "latency is zero" and "bandwidth is infinite".

Your progress is saved only in this browser. Export it to keep it safe.

Was this clear?
Report a mistake (opens GitHub in a new tab)
Section 8 of 8

Go deeper

Show 4 sources and related lessons
  1. Laura Nolan, “Slack's Outage on January 4th 2021”, Slack Engineering (February 2021) (opens in a new tab)
    The official postmortem. A cloud network link dropped packets, monitoring failed, and autoscaling read the signs wrong.
  2. Martin Kleppmann, “Distributed Systems” lecture notes, University of Cambridge, 2021/22, sections 1–3 (opens in a new tab)
    Free notes. Partial failure, RPC with no response, the two generals problem, system models, pauses and quartz clock drift.
  3. Jacob Gabrielson, “Challenges with distributed systems”, Amazon Builders' Library (2019) (opens in a new tab)
    The eight steps of one request and reply, why a timeout means the result is unknown, and why distributed bugs hide.
  4. Arnon Rotem-Gal-Oz, “Fallacies of Distributed Computing Explained” (white paper, based on his Dr. Dobb's articles) (opens in a new tab)
    The eight fallacies, who first wrote them down, and what each one means for your design.

Real incident: Slack, 4 Jan 2021: Slack outage: post-holiday traffic overloaded a cloud network link

Related: TCP/IP and the network stack · Idempotency, retries and timeouts · Time, clocks and ordering · Failure detection and membership · CAP, PACELC and consistency models · Replication · Consensus and Raft · Circuit breakers, bulkheads and fallbacks

Start with the lessons in the map above. For the network basics underneath, see TCP/IP and the network stack. For the full Slack story, read the postmortem, and see the incident page.

Term

See full entry

Jump to a section

  1. 1What broke
  2. 2The idea in simple words
  3. 3How it works
  4. 4Trade-offs
  5. 5At work
  6. 6With AI
  7. 7Check yourself
  8. 8Go deeper