I am using ZooKeeper to store hierarchical data. In one test I stored more than 300K children for under one node. ZK client crashed due to a ConnectionLossException when I tried to retrieve ALL children.
Remodeling the data might solve the problem (e.g. by bucketing as it reduces the number of children per node).
However I am curious to know the answers of the following questions:
Thanks!
There's no explicit limit to the number of children.
However, there is a
limit to the size of the packet that can be sent back from the server in
response to getChildren
which effectly ends up being the limit. This is
controlled with a system property, jute.maxbuffer
and defaults to 4MB (I
think you can get a around 200,000 znodes into this, though it also depends
on the length of the znode name).
Check out this link for the full discussion.
Just a day ago, there was an issue on Zookeeper version 3.4.4 where nearly 800K nodes ended up under a single parent node and was causing issues when trying to access that parent node. Tried a few different methods found for deleting a node, of which none of them worked. All hit ConnectionLoss KeeperExceptions.
The -Djute.maxbuffer
java option when run with a java8 program that uses ZKUtil.deleteRecursive( zk, path );
via the 3.4.14 java client (not the 3.4.4 java client) worked to delete the 800K children znodes. This jopt did not have to be placed on the server side. It was a purely client side change. Did not work with the 3.4.14 zkCli command line client however.
Through the zookeeper source , there's no explicit limit to child count . But the childCount
is int
type , the max should is Integer#MAX_VALUE
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With