You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Peng Li <pe...@gmail.com> on 2016/10/14 05:59:57 UTC

Extending session lifetime with client requests

Hi there,

Suppose a zookeeper session timeout is configured to 10 seconds. If at time
t, a client sends a getData() request to the ensemble and succeeds, can I
assume the client's zookeeper session will be live for the next (10 -
delta) seconds according to the client's local clock? In other words, will
a client request extend the lifetime of the session by another session
timeout?

The delta will account for clock skew between client and server. In
practice, the clock skew is bounded and very small (<<10 seconds) in a 10
seconds interval. Absolute clock skew doesn't matter. Only the clock rate
skew matters.

Cheers
Peng

Re: Extending session lifetime with client requests

Posted by Michael Han <ha...@cloudera.com>.
The liveness of a session is maintained by heart beats between ZK client
and server, and this heartbeat comes as two forms: the periodic ping, or an
explicit request (e..g getData). So yes, a client sends a getData request
will extend the timeout of the session.

>> In other words, will a client request extend the lifetime of the session
by another session timeout?

I think the session will be extended to some value close to 'another
session' - might not be exact value because ZK group sessions into buckets
for expiration, so a session is not expired precisely as it's configured,
but it should be something close.

>> session timeout is configured to 10 seconds
Please be aware that ZK server has minSessionTimeout and maxSessionTimeout
configuration which could override what you configured at client side - the
final session timeout value is some value between the two (if both values
were not configured explicitly, then default multiples of tick time is
used).

On Thu, Oct 13, 2016 at 10:59 PM, Peng Li <pe...@gmail.com> wrote:

> Hi there,
>
> Suppose a zookeeper session timeout is configured to 10 seconds. If at time
> t, a client sends a getData() request to the ensemble and succeeds, can I
> assume the client's zookeeper session will be live for the next (10 -
> delta) seconds according to the client's local clock? In other words, will
> a client request extend the lifetime of the session by another session
> timeout?
>
> The delta will account for clock skew between client and server. In
> practice, the clock skew is bounded and very small (<<10 seconds) in a 10
> seconds interval. Absolute clock skew doesn't matter. Only the clock rate
> skew matters.
>
> Cheers
> Peng
>



-- 
Cheers
Michael.