Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 37 ยท Getting Started

The Fallacies of Distributed Computing

The eight fallacies of distributed computing explained for microservices: latency, partial failure, timeouts and retries, with a simulated unreliable network.

In the 1990s, engineers at Sun Microsystems wrote down a list of assumptions that programmers new to networks keep making and that are always wrong. They are known as the fallacies of distributed computing. Every one of them bites microservice teams, because splitting a program into services turns each function call into a network call.

This lesson walks through the eight fallacies with a focus on what they mean for services, then lets you feel the two most important ones, latency and partial failure, with a simulated network that is slow and sometimes drops requests. The goal is a habit: whenever one service calls another, ask "what if this is slow, fails, or happens twice?".

The eight fallacies

Reliable network Packets get lost.
Zero latency Every hop takes time.
Infinite bandwidth Big payloads are slow.
Secure network Inside the firewall is not safe.
1 / 2

Why they matter for microservices

In a monolith, stock.reserve(item) either returns or throws. It takes microseconds and runs in the same memory. In a service architecture, the same line is a request that travels through several network devices, waits in queues, runs on another machine and travels back. Many things can go wrong that cannot go wrong locally.

1. The network is reliable

Requests and responses get lost, connections reset, load balancers restart. The critical consequence is partial failure: when you send a request and hear nothing back, you do not know what happened. Maybe the request never arrived. Maybe it arrived, was processed, and the response was lost. From the caller's point of view both look identical: silence.

That is why payments and orders need idempotency (safe to repeat) and why every call needs a timeout so the caller does not wait forever. See Timeouts, Retries and Exponential Backoff.

2. Latency is zero

A function call costs nanoseconds. A call inside one data center costs around a millisecond or more; across continents it costs tens to hundreds of milliseconds. Chains multiply it: if a page needs six sequential service calls of 40 ms each, the page cannot be faster than 240 ms, however fast each service is internally. Worse, latency varies: the slowest few percent of calls (the "tail") dominate what users feel when a request fans out to many services.

3. Bandwidth is infinite

Large responses cost real time and money. Returning a whole customer record with its order history when the caller needs one field wastes bandwidth. Design APIs that return what callers need, and paginate lists.

4. The network is secure

Traffic between services can be sniffed, and an attacker who gets into one service can call others. Treat the internal network as hostile: authenticate calls, encrypt traffic and apply least privilege (Authentication and Authorization Between Services).

5. Topology does not change

Instances start, stop, move and scale constantly. Hard-coding an IP address breaks within hours. Services find each other through discovery (Service Discovery and Load Balancing).

6. There is one administrator

Different teams, and often different companies, run different services with different release schedules and rules. You cannot assume that everything upgrades at once, which is why contracts must evolve compatibly (API Versioning and Evolving Contracts).

7. Transport cost is zero

Serialization (turning objects into bytes and back), compression and network egress consume CPU and money. A chatty design with thousands of tiny calls per request is expensive in both.

8. The network is homogeneous

Services run different languages, libraries, versions and formats. Agree on explicit contracts (JSON schemas, protobuf definitions) instead of assuming everyone understands each other's internals.

Feeling latency and failure

The simulation below models a remote call. It uses a small seeded random generator so the numbers are the same every run; a real network gives you different numbers each time. Each call has a latency between 20 and 120 ms, and one call in five is dropped, meaning that it never answers. A caller without a timeout would wait forever, so we give it one.

Time here is virtual: we add up milliseconds instead of really sleeping, so the example runs instantly. This is a model, not a measurement of any real network.

Node.js An unreliable network call with a timeout

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Look at how the trade-off moves. A tight timeout fails fast, so it wastes little time, but it also gives up on calls that would have succeeded. A loose timeout succeeds more often, but every dropped call then holds its caller for the full 200 ms. There is no perfect value: you choose it from the latency your dependency really has (look at a high percentile such as p99, not the average) and the time your own caller can afford.

The danger of silence

The worst case is not a failed call but an unknown call. The next example makes it concrete. A client asks a payment service to charge an order. The charge succeeds, but the response is lost. The client sees a timeout, retries, and without protection charges the customer twice.

Node.js Lost response and the double charge

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The fix costs one lookup: the client sends a unique key with the request, and the service remembers which keys it has already handled. Idempotency is the single most important defense against the unreliable network, and it returns in Synchronous Communication with HTTP APIs and The Transactional Outbox and Idempotent Consumers.

Both examples are models. They run in one process with virtual time, so they cannot show real packet loss, clock skew or reordering. A real test of resilience needs real separate processes, which Resilience and the projects later in this tutorial approximate with loopback servers.

Design habits that follow

Turn the fallacies into rules you apply to every cross-service call.

  • Always set a timeout; never rely on a default of "forever".
  • Decide the fallback if the call fails: an error, a cached value, or a reduced feature.
  • Make writes idempotent so retrying is safe.
  • Keep chains short and prefer parallel calls or asynchronous messages when you can.
  • Send only what is needed and paginate lists.
  • Authenticate and encrypt internal traffic.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A client sends a payment request and hears nothing back before its timeout. What does the client actually know?

    Silence is ambiguous. The request may have been lost, or processed with the response lost. That is why retries must be safe through idempotency.
  2. 2. A page needs six sequential service calls of 40 ms each. What is the lowest possible page time from the calls alone?

    Sequential latencies add up, so six calls of 40 ms take at least 240 ms. Parallel calls or fewer calls reduce it.
  3. 3. Why is hard-coding the IP address of another service a bad idea?

    'The topology does not change' is one of the fallacies. Use service discovery or stable names so instances can come and go.
  4. 4. In the timeout simulation, what happened when the timeout was raised from 50 ms to 200 ms?

    A longer timeout rescues slow-but-successful calls, but dropped calls now wait for the whole timeout. Timeouts always trade success rate against waiting time.

Summary

  • The fallacies of distributed computing are false assumptions about the network: reliability, latency, bandwidth, security, topology, administration, cost and homogeneity.
  • Partial failure means a silent call is ambiguous: it may or may not have been processed.
  • Always set timeouts, choose a fallback, make writes idempotent and keep call chains short.
  • Latency adds up along sequential calls, and the slowest calls shape the user experience.
  • The simulations here use one process and virtual time; they model the ideas, not a real network.

Next: Finding Boundaries with Domain-Driven Design.