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 <waite....@googlemail.com> wrote:

> Hi,
> 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.
> regards,
> Martin

Henry Robinson
Software Engineer

Reply via email to