zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Chaudhuri, Shirsha (Nokia - IN/Bangalore)" <shirsha.ray_chaudh...@nokia.com>
Subject RE: How to modify Client Connection timer
Date Wed, 22 Mar 2017 21:19:31 GMT

Thanks Patrick.

Yes, we did eventually figure out that this timeout value is initialised from the Hadoop ZKFC
code with the value of "ha.zookeeper.session-timeout.ms" or if this is not set, then the default
is 5000. Since the client Cnxn class sets this timer value to a value _  (session timeout)
/ (number of ZK servers), the timer value for the initial connection to complete is one third
the value of 5000. Hence the timeout occurring at around 1.6s each time.

Which brought us to the question that wouldn't this piece of code highlighted from the file
zookeeper/ClientCnxn.java _
    public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZooKeeper

            ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket,

            long sessionId, byte[] sessionPasswd, boolean canBeReadOnly) {

        this.zooKeeper = zooKeeper;

        this.watcher = watcher;

        this.sessionId = sessionId;

        this.sessionPasswd = sessionPasswd;

        this.sessionTimeout = sessionTimeout;

        this.hostProvider = hostProvider;

        this.chrootPath = chrootPath;

        connectTimeout = sessionTimeout / hostProvider.size();

        readTimeout = sessionTimeout * 2 / 3;

        readOnly = canBeReadOnly;

        sendThread = new SendThread(clientCnxnSocket);

        eventThread = new EventThread();



Be leading to trouble if the number of ZK Servers is larger?

This timeout value is initially used when the Client is waiting to connect with the server,
even before it has negotiated a sessiontimeout value.

So larger the number of ZK Servers, less will be the timer value. Shouldn’t we have a lower
guard for it and ensure that atleast a min value is used for this timer?



-----Original Message-----
From: Patrick Hunt [mailto:phunt@apache.org]
Sent: Wednesday, March 22, 2017 11:55 PM
To: UserZooKeeper <user@zookeeper.apache.org>
Subject: Re: How to modify Client Connection timer

You should be able to control that by increasing the session timeout. I'm not familiar with
the client code you are using however. Additionally the ZK client should retry it's connection
(as long as you don't close the ZK

object) continually until it is able to reconnect.


On Mon, Mar 20, 2017 at 3:22 PM, Ray Chaudhuri, Shirsha (Nokia -

IN/Bangalore) <shirsha.ray_chaudhuri@nokia.com<mailto:shirsha.ray_chaudhuri@nokia.com>>

> Hi,


> We are using ZKFC  as a Zookeeper Client that tries to connect to

> Zookeeper Server at the time of bringup, when we sometimes encounter

> the following issue _


> 1.       Client retrieves the ZK Ensemble address (ensemble consists of 3

> nodes)


> 2.       Client tries to connect to one of the ZK Server nodes


> 3.       However due to other on-going processing (required at the time of

> bringup) at the ZK Server Node, it fails to respond in time to the Client.

> The response goes after 3 seconds


> 4.       The Client side times out by then, typically seen around 1.6 sec


> Is there a way this timer at the Client side can be reconfigured to a

> higher value?


> Regards

> Shirsha

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message