zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michi Mutsuzaki <mi...@cs.stanford.edu>
Subject Re: Latency in asynchronous mode
Date Sat, 25 Oct 2014 23:35:43 GMT
> submitTimeWrite = (double)System.nanoTime();//catch start time of sending request
> _client.create().inBackground(new Double(time)).forPath(_path + "/" + _count, data);//creade
a node in Zookeeper
> endTimeWrite = (double)System.nanoTime();//catch end time of executed request
> latencyInfos.add(""+((endTimeWrite - submitTimeWrite)/1000000)); // add latency per request
to array list.

This code snippet is measuring time to enqueue a request to ZooKeeper
client. "endTimeWrite" needs to be set after the operation completes.
Register a listener to the curator client and set endTimeWrite in the
eventReceived callback. It looks like you are already passing the
start time as a context. You can access the start time in the callback
by calling CuratorEvent.getContext().

View raw message