educative.io

Educative

Database - Eventual Consistency

In this chapter lets say the number of like in japan is 100 and a user liked the post it turned to 101 and at the same time a user in america liked the post. so how the writes are handled when there is no lock or mutex variable ? how the db value will be 102 ? instead of 101 eventually

@Abhignana_Mihir this is achieved with the help of consensus algorithms like Raft, Paxos & so on. The distributed systems like Google BigTable implement these algorithms to achieve a consensus amongst thousands of nodes deployed globally.

Consensus means achieving a common value amongst multiple server nodes. In other words all the nodes deployed reach a consensus, they agree on a common value for a particular object.

If you read the whitepaper for BigTable. It uses the Paxos algorithm to reach a consensus amongst its nodes.

1 Like