Why many machines are harder than one: slow networks, partial failures and no shared clock.
A distributed system is many computers that work together and look like one system to the user. It gives you more power and no single machine to lose, but it is much harder to get right than one computer.
On one computer, things are simple. A function call either works or crashes. Memory is shared. There is one clock. If the machine dies, everything dies together, and you know it.
When you spread the work over many machines, you lose these comforts. You can still get the benefits: more capacity, no single point of failure, and servers close to users. But a new set of problems appears, and they are the reason this whole Part exists.
The main challenges are:
Engineers at Sun Microsystems listed the wrong guesses that new distributed-system builders make. They are called the fallacies of distributed computing. Every one is false.
| Wrong belief | The truth | What to do about it |
|---|---|---|
| The network is reliable | Packets are lost, cut or blocked | Timeouts, retries, acknowledgements |
| Latency is zero | Every call takes time, and sometimes a lot | Fewer calls, caching, async work |
| Bandwidth is infinite | Links have a limit and cost money | Compress, send less, batch |
| The network is secure | Traffic can be read or changed | TLS, authentication on every call |
| Topology does not change | Machines come and go all the time | Service discovery, no hard-coded addresses |
| There is one administrator | Many teams and companies run parts | Clear contracts, monitoring, versioning |
| Transport cost is zero | Serialising and sending data costs CPU and money | Efficient formats, fewer round trips |
| The network is homogeneous | Different hardware, software and versions | Standard protocols, tolerant readers |
A simple model: every call fails or is slow on its own, with the chances you set (no random numbers, just the maths). A normal call takes 20 ms and a slow one 1000 ms. Real failures are often linked, for example when one network switch breaks many calls at once, which is worse than shown here.
| Term | Meaning in easy words |
|---|---|
| Distributed system | Many computers that work together and look like one system |
| Node | One machine (or process) in the system |
| Partial failure | Some parts fail while the others keep running |
| Latency | The time a message takes to travel and be answered |
| Timeout | A limit on how long to wait for a reply before giving up |
| Network partition | The network splits so groups of nodes can not talk to each other |
| Clock drift | Two clocks slowly show different times |
| Idempotent | Doing it twice has the same result as doing it once |
| Consensus | Several nodes agreeing on one value, even when some fail |
| Fallacies of distributed computing | Eight wrong assumptions about networks, such as 'the network is reliable' |
| Fault tolerance | The ability to keep working when parts fail |
| Choice | We gain | We lose |
|---|---|---|
| One big machine | Simple, fast calls, easy to reason about | A hard size limit and one thing that can fail |
| Many machines | Scale and fault tolerance | Network problems, complexity and cost to run |
| Retry on failure | Hides short glitches from users | Duplicates and extra load, unless idempotent |
| Long timeout | Fewer false alarms | Slow failure detection, users and threads wait |
| Short timeout | Fast failure detection | Healthy but slow machines look dead |
| Strong agreement | Everyone sees the same data | Slower, and may refuse requests during failures |