Rohitashwa Nigam
Rohitashwa Nigam

Reputation: 408

Consensus Service vs Lock Service?

Going through the Google's Chubby Paper,

Like a lock service, a consensus service would allow clients to make progress safely even with only one active client process; a similar technique has been used to reduce the number of state machines needed for Byzantine fault tolerance [24]. However, assuming a consensus service is not used exclusively to provide locks (which reduces it to a lock service), this approach solves none of the other problems described above

they mention how Chubby is not a consensus service, but a lock service, and also how a consensus service could be used to achieve consensus amongst a peer of nodes as well.

In my understanding I thought services like Chubby and Zookeeper are used to offload your distributed application problems (like leader election, cluster management, access to shared resources) to a different application (chubby/zookeeper) and these are lock based services. Having locks on files/znodes in how consensus is achieved.

What are consensus services and how are they then different from lock services ?

When would one use either of them ?

Upvotes: 2

Views: 595

Answers (2)

djechlin
djechlin

Reputation: 60848

You can take a lock to propose your value, publish your value, and that's the consensus.

Upvotes: 1

rustedGeek
rustedGeek

Reputation: 236

Zookeeper is a co-ordination service, modeled after Google's Chubby The major features it provides are

  • Linearizable atomic operations
  • Total ordering of operations
  • Failure detection
  • Change notifications

Out of these, Linearizable atomic operations requires ZooKeeper to implement a consensus algorithm (Zab), and therefore Linearizability can be used for achieving consensus among peers in distributed systems, using Zookeper locks

Quoting from the book Designing Data-Intensive Application

Coordination services like Apache ZooKeeper [15] and etcd [16] are often used to implement distributed locks and leader election. They use consensus algorithms to implement linearizable operations in a fault-tolerant way

Based on my understanding, consensus services, and coordination services, both run on top of some consensus algorithm, it's just that lock-services represent that consensus through a distributed lock

Similar to what is also mentioned in the Chubby paper,

However, assuming a consensus service is not used exclusively to provide locks (which reduces it to a lock service)

I found chapter 9, "Consistency and Consensus" from the book Designing Data-Intensive Applications, to be very helpful on this topic, if you wanna dig further, would definitely recommend reading that

Upvotes: 5

Related Questions