Not sure if there is a jira on this but I have long been lobbying the team to add a new API/feature that allows clients to get a view of the "global clock". I think this would be a very useful (although admittedly potentially damaging) feature to add, esp around leases. If we think leases are something that we want to provide in future we may want to think about how we could more easily support this type of recipe.


Henry Robinson wrote:
A cautionary note with this problem - who says when 2 minutes is up? Clocks
will go forward at different rates and with different offsets. You cannot
rely on two machines having the same perception of what 2 minutes means. In
general, in distributed systems, it's a good design principle to minimise
any dependence on a common notion of real time.

That said the best way is to pick some machine, like Mahadev says, to retire
old locks by polling every N seconds, where N is the slop you can afford.

What problem are you actually trying to solve?


On 24 February 2010 03:40, Martin Waite <> wrote:


Is there a good model for implementing leases in Zookeeper ?

What I want to achieve is for a client to create a lock, and for that lock
to disappear two minutes later - regardless of whether the client is still
connected to zk.   Like ephemeral nodes - but with a time delay.


Reply via email to