Continuing with the sample system we looked at in the Consistency section, let's look at how these independent instances can reach an agreement. Agreements can take various forms, for example, if an email to a customer needs to be sent by a single service instance, then all the instances need to agree on which instance serves which customer.
Broadly, consensus is the process by which all nodes of a distributed system agree on some specific value for a variable. This seemingly simple problem finds large applicability in the field of distributed systems. Here are some examples:
- Leader elections: In a cluster of nodes, choosing one who will handle the interactions
- Distributed lock manager: Handling mutual exclusion between multiple machines
- Distributed transactions: Consistent transactions across a set of machines
For the purpose of this discussion, let's assume...