Distributed consensus in closed environment

Consider following messages communication between two persons:

·       Mr. A: Hey Mr. B! Let’s have a drink.

·       Mr. B: What about coffee? 💡

·       Mr. A: Cool. coffee it is. 🤝

Mr. A and Mr. B wanted to have a drink. Mr. B SUGGESTED 💡 having “coffee”. Mr. A AGREED 🤝 to Mr. B’s suggestions and both of them are having “coffee”.

They both agreed on a VALUE that is SUGGESTED by one of them and took actions based on that VALUE. This is a consensus.

In simple words, a consensus is a general agreement on value.

 

So what is a consensus in a distributed system?

·       There were only two parties to agree on what to drink in the above scenario.

·       What if three or four more people joined them. They may give more suggestions and more votes on what to drink.

·       So, when multiple parties trying to agree on some value, it is a distributed consensus problem. In such a case, coming to an agreement is not that easy.

·       When the number of parties involving the agreement goes higher, the complexity of achieving consensus is going higher too.

As a simple definition, it can be said that a distributed system is s set of nodes (generally computers) that are accomplishing a common task concurrently by communicating with each other over a network. With that idea of a distributed system, it can be said that nodes in a distributed system agreeing on some value is a distributed consensus.

 

Why distributed consensus?

·       Nodes in distributed systems are trying to achieve some common goal (maybe processing a large computation). Then they need some kind of coordination among them.

·       They need to know the effect of their doings to the whole system. That’s where distributed systems need a consensus protocol.

·       In any distributed consensus protocol a node can say “Guys, I SUGGEST value v. Do you all agree?” 💡. Only after all of the other nodes AGREED 🤝 on v, each node (including suggesting node) can carry on their work keeping “v is decided” in their mind.

·       Another node can also say “I prefer w.” and SUGGEST another value(w) before the system decides v. Then the distributed system should choose either v or w. In such a case, achieving consensus is a bit complicated process.