queue with limit to number of simultaneous tasks

2009-07-14 Thread Alexander Sibiryakov
Hello everybody! Please give me advice about designing application on zookeeper. I'd like to implement queue with limit on number of simultaneous tasks. For example I have 10 tasks, and I can process only 2 tasks simultaneously. When one task is finished processing, system should start

Read-your-writes consistency?

2009-07-14 Thread Marc Frei
Dear ZooKeeper users, a short question about ZooKeeper's consistency model: Does ZooKeeper support read-your-writes consistency? E.g., after having created a node, will the same client always find the newly created node via getChildren? If yes, is this specified behavior the client can rely on?

Re: Question about the sequential flag on create.

2009-07-14 Thread Patrick Hunt
Nodes are maintained un-ordered on the server. A node can store any subnodes, not exclusively sequential nodes. If we added an ordering guarantee then then server would have to store the children sorted for every parent node. This is a problem for a few reasons; 1) in many cases you don't care

Re: Read-your-writes consistency?

2009-07-14 Thread Patrick Hunt
Yes, this is a strong guarantee: http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkGuarantees Sync is only necessary if client A makes a change, then client B wishes to read that change with guarantee that it will see the successfully applied change previously made

Re: Question about the sequential flag on create.

2009-07-14 Thread Erik Holstad
Hey Patrik! Thanks for the reply. I understand all the reasons that you posted above and totally agree that nodes should not be sorted since you then have to pay that overhead for every node, even though you might not need or want it. I just thought that it might be possible to create a sequential

Re: Question about the sequential flag on create.

2009-07-14 Thread Benjamin Reed
the create is atomic. we just use a data structure that does not store the list of children in order. ben Erik Holstad wrote: Hey Patrik! Thanks for the reply. I understand all the reasons that you posted above and totally agree that nodes should not be sorted since you then have to pay that

Re: Question about the sequential flag on create.

2009-07-14 Thread Erik Holstad
Thanks Patrick!

Instantiating HashSet for DataNode?

2009-07-14 Thread Erik Holstad
I'm not sure if I've miss read the code for the DataNode, but to me it looks like every node gets a set of children even though it might be an ephemeral node which cannot have children, so we are wasting 240 B for every one of those. Not sure if it makes a big difference, but just thinking that

Re: Instantiating HashSet for DataNode?

2009-07-14 Thread Mahadev Konar
Hi Erik, I am not sure if that would a considerable opitmization but even if you wanted to do it, it would be much more than just adding a check in the constructor (the serialization/deserialization would need to have specialized code). Right now all the datanodes are treated equally for

Re: Instantiating HashSet for DataNode?

2009-07-14 Thread Patrick Hunt
Erik, if you'd like enter a JIRA and take a whack at it go ahead. Perhaps a subclass of DataNode specific for ephemerals? That way it can handle any particulars - and should also minimize the number of if(children==null) type checks that would be needed. (don't neg. impact performance or b/w

Re: Instantiating HashSet for DataNode?

2009-07-14 Thread Erik Holstad
Will file Jira and have a stab at it when I get a little time. Thanks guys!