Quantcast

Multiple ZooKeeper client instances

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multiple ZooKeeper client instances

Satish Bhatti
If my application has several objects who are using ZooKeeper for entirely
unrelated reasons, is it recommended to create one ZooKeeper client instance
and share it, or to create one per object?  Do the ZooKeeper client
instances have a lot of overhead?  I am thinking that having one instance
per object will lead to simpler code in terms of handling Session
expirations.
Satish
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple ZooKeeper client instances

Mahadev Konar
HI Satish,
  A zookeeper client usually has a very small footprint for memory and cpu.
The mutithreaded version of zookeeper client creates an internal thread to
do the io and callbacks. I would  suggest using the same zookeeper client
across the objects to have less number of threads in your client process.

mahadev

On 4/24/09 2:37 PM, "Satish Bhatti" <[hidden email]> wrote:

> If my application has several objects who are using ZooKeeper for entirely
> unrelated reasons, is it recommended to create one ZooKeeper client instance
> and share it, or to create one per object?  Do the ZooKeeper client
> instances have a lot of overhead?  I am thinking that having one instance
> per object will lead to simpler code in terms of handling Session
> expirations.
> Satish

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple ZooKeeper client instances

erezmazor
What about the scenario where I have tomcat running multiple webapps each with it's own client? Could there be an interference between the clients causing frequent session expirations?

I am seeing a lot of session expiration messages in the log:

DEBUG [main-EventThread] [ZkEventThread:88]     - New event: ZkEvent[State changed to Expired sent to com.outbrain.zookeeper.ZooKeeperClientStatsCollector

(using https://github.com/sgroschupf/zkclient)

I have looked at:

https://issues.apache.org/jira/browse/ZOOKEEPER-344
http://wiki.apache.org/hadoop/ZooKeeper/Troubleshooting
http://zookeeper.apache.org/doc/r3.1.1/zookeeperAdmin.html#sc_commonProblems

But it doesn't seem like the clients are swapping, server has transaction log on fast media and is running with >4GB ram.

I started seeing this problem occur more when I move from 2 webapps on a tomcat instance to 3.
Loading...