The client sends heart-beats to the server. When the time since the last
heartbeat is long enough, the server deems the client to have failed or
been partitioned away from the cluster.
If you have heartbeats every 5s and an session expiration time of 10s, then
if you kill the connection just before the next heartbeat, the server would
be justified in expiring the session 5+epsilon seconds after the connection
You can configure heartbeats to occur more often if you want.
On Sat, Dec 31, 2011 at 4:32 AM, 朱晨杰 <[EMAIL PROTECTED]> wrote:
> Hi, everyone:
> I have done some tests and find that the expired time of ephemeral node
> is not accurate. I set my connection's timeout to be "10s" when connecting
> to zookeeper. Then I create an ephemeral node. I start another application
> set watch on this ephemeral node. When I close the first connection, the
> watch will be triggered and I got the message. I compare the time when I
> close the connection and the time when I got the message reporting the
> disappearance of the ephemeral node, I find it's always not 10 seconds.
> Most of the situation, it will be less than 10 seconds, about 8, or 7, even
> 6 seconds. Can anyone tell me why this happen? I want to figure out how
> does zookeeper decide a connection expire. Thanks
> Zhu Chenjie
> Zhejiang University, China