See http://zookeeper.apache.org/doc/r3.2.2/zookeeperAdmin.html#sc_configurationfor more information.
The minimum session expiration time is a small multiple of this number so it isn't surprising that you still see inaccuracy. Have you tried setting it to a very small value like 200? 2011/12/31 朱晨杰 <[email protected]> > Hi, Ted: > In the Zookeeper config file, I set tickTime=1000, does this parameter > decide the frequency of heartbeat? I have change this parameter to > different value, but the expiration time is still not accurate > > 2012/1/1 Ted Dunning <[email protected]> > > > 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 > > is lost. > > > > 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 > > > > > > > > > -- > Zhu Chenjie > Zhejiang University, China >
