Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper, mail # dev - Listing the znodes efficiently


Copy link to this message
-
Re: Listing the znodes efficiently
Narayanan Arunachalam 2012-05-18, 00:04
Another approach to improve the performance:
For example creating znode to represent something "/abc001"
Compute hash and index of the slot for the resource name using HashMap like hash() and indexFor() methods. So if the slot size is 10 this could result in a number between 0 and 9. Assume we get 4 for this path.
Create znode /4/abc001
So the nodes gets distributed like in a HashMap.
For listing:
Do a getChildren() on /0 and /1 and so on to bring back the desired results.

On May 17, 2012, at 3:31 PM, Patrick Hunt <[EMAIL PROTECTED]> wrote:

> On Thu, May 17, 2012 at 1:55 PM, Narayanan A R
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Does ZK has or have plans to add the following features:
>>
>> - Query znodes under a path by passing filter on the attributes.
>
> Sounds intriguing, depending on the details. Might be a good addition
> to the multi* feature. (not discussed before afaik)
>
>> - Ability to paginate the znodes under a given path.
>
> Check jira/mailarchives - this has definitely been discussed in the
> past. (Henry iirc... aha, see here
> https://issues.apache.org/jira/browse/ZOOKEEPER-423 but search around,
> you'll likely find more)
>
>> Without this, the app has to pull all the nodes and perform the comparison
>> at the client end.
>
> Yes, that's true of what's available today.
>
> Patrick