zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Junqueira <fpjunque...@yahoo.com.INVALID>
Subject Re: Zookeeper number of re-tries
Date Wed, 26 Aug 2015 12:33:09 GMT
Hi Prabhjot,

There is no such a contention in zookeeper. If multiple clients try to acquire a lock by creating
a znode, assuming they are all connected fine, then one is guaranteed to succeed. You can
also consider using sequential nodes to establish an order across the clients and avoid the
kind of herd effect you're alluding to. Each client creates a sequential node and based on
the sequence number it gets, it watches the next one up the sequence unless it is the first,
in which case it holds the lock. This scheme guarantees that only one client wakes up when
the lock is released.

-Flavio


> On 26 Aug 2015, at 10:32, Prabhjot Bharaj <prabhbharaj@gmail.com> wrote:
> 
> Hello Folks,
> 
> I have a simple question on zookeeper client.
> If I have 10 clients and all of them try to get a lock and all of them fail
> (lets say because of some temporary network glitch), then, all of them will
> retry. If the number of retries for each client is 3, then it results in a
> total of 30 retries (in the worst case)
> 
> Considering another case where the request to get lock fails for the first
> time for all 10 clients, but after that, one of the clients gets the lock
> while others were still trying. In this case, will other clients still try
> for the remaning number of times ? Or should they exit out with a negative
> response ?
> 
> Regards,
> Prabhjot


Mime
View raw message