Hi Ibrahim,
  let me try this again :-)

- You have a process that generates a sequence of Zookeeper requests
that will be executed asynchronously.

- This process will - due to the asynchronous nature of the request
submission - only know when the last request has been sent off, not when
the last request has actually been executed by Zookeeper.

- You can find out the start time of the entire process (just before the
first request is sent).

- You cannot find out the end time of the entire process (just after the
last request has been executed).

So, you want get notified when all of the work has been done. This can
be accomplished by a special, additional request to set the value of a
znode, e.g., /tests/status to a certain value. What you should do now is
(preferably in a separate process that gets its own ZooKeeper session):

- Just before you start the submission of the test requests, run the
watcher process and let it create this node /tests/status if it does not
already exist.

- In the watcher process, then get the data of this node with
ZooKeeper.getData(String, Watcher, Stat) and a Watcher that's non-null.
The Watcher could simply log the time when it encounters any event. That
should suffice.

- Now run your test code with all of your tests, submitting a gazillion
of funny requests to Zookeeper.

- Finally, in the test program, in the same session as the tests
themselves, change the value of your special, well-known znode
/tests/status via ZooKeeper.setData(String, byte[], int) to some new
value, e.g., the current time as a simple String.

- When this has been executed, the test process can die.

- The watcher process will get notified when the update request to
/tests/status *has been executed*, print the test end time and you'll be
happily computing the difference.

That's it. I hope this is a bit more clear now :-) ...assuming, of
course, that you're doing the clients in Java.

Cheers,
--Jürgen


On 11.11.2014 06:00, Ibrahim wrote:
> Hi Jürgen,
>
> When you say "Then set up a watcher for this special node to get notified
> when Zookeeper has finished processing all requests". 
>
> In fact, the main reason for posting this question is that I do not know
> when Zookeeper will finish processing all requests (In Async mode). I need
> to catch end time.
>
> Can you give me hint with this?
>
> Thanks alot
>
> Ibrahim
>
>  
>
>
>
> --
> View this message in context: 
> http://zookeeper-user.578899.n2.nabble.com/Best-strategy-to-test-Zookeeper-tp7580580p7580584.html
> Sent from the zookeeper-user mailing list archive at Nabble.com.


-- 

Mit freundlichen Grüßen/Kind regards/Cordialement vôtre/Atentamente/С
уважением
*i.A. Jürgen Wagner*
Head of Competence Center "Intelligence"
& Senior Cloud Consultant

Devoteam GmbH, Industriestr. 3, 70565 Stuttgart, Germany
Phone: +49 6151 868-8725, Fax: +49 711 13353-53, Mobile: +49 171 864 1543
E-Mail: juergen.wag...@devoteam.com
<mailto:juergen.wag...@devoteam.com>, URL: www.devoteam.de
<http://www.devoteam.de/>

------------------------------------------------------------------------
Managing Board: Jürgen Hatzipantelis (CEO)
Address of Record: 64331 Weiterstadt, Germany; Commercial Register:
Amtsgericht Darmstadt HRB 6450; Tax Number: DE 172 993 071


Reply via email to