Failure in the World of Distributed Systems
Let's see why failures occur in distributed systems, and how we can detect them.
We should understand that it is challenging to identify failure because of all the characteristics of a distributed system that the Difficulties Designing Distributed Systems lesson described. One of them is the asynchronous nature of the network.
One reason for failure
The asynchronous nature of the network in a distributed system can make it very hard for us to differentiate between a crashed node and a node that is just really slow to respond to requests.
One mechanism to detect failure
Timeouts is the main mechanism we can use to detect failures in distributed systems. Since an asynchronous network can infinitely delay messages, timeouts impose an artificial upper bound on these delays. As a result, we can assume that a node fails when it is slower than this bound. This is useful because otherwise, the assumption that the nodes are extremely slow would block the system that is waiting for the nodes that crashed.
However, a timeout does not represent an actual limit. Thus, it creates the following trade-off.
Trade-off for the small timeout value
If we select a smaller value for the timeout, our system will waste less time waiting for the nodes that have crashed.
At the same time, the system might declare some nodes that have not crashed dead, while they are actually just a bit slower than expected.
The following illustration shows this trade-off phenomenon.
Get hands-on with 1400+ tech skills courses.