private static void runJRedisPipelineGET (ConnectionSpec spec, int reqCnt, int size, boolean forever) {
long totTime = 0;
long avgRespTime = 0;
float avgThroughput = (float)0;
long iters = 0;
JRedisFuture pipeline = new JRedisPipeline(spec);
try {
String key = "pipeKey";
byte[] data = new byte[size];
(new Random()).nextBytes(data);
pipeline.del(key);
pipeline.set(key, data);
do {
int cnt = 0;
Util.Timer timer = Timer.startNewTimer();
Future<byte[]> futureBytes = null;
while(cnt < reqCnt){
futureBytes = pipeline.get(key);
cnt++;
}
long reqDoneTime = timer.mark();
byte[] value = futureBytes.get();
long respDoneTime = timer.mark();
// System.out.format("JRedisPipeline: %d GETs invoked @ %5d (%.2f ops/s)\n", cnt, reqDoneTime, timer.opsPerSecAtDelta(cnt, reqDoneTime));
float throughput = timer.opsPerSecAtMark(cnt);
// System.out.format("JRedisPipeline: %d GETs completed @ %5d (%.2f ops/s) [%d msecs to comp] \n", cnt, timer.deltaAtMark(), throughput, respDoneTime-reqDoneTime);
if(iters > 0){
totTime += respDoneTime;
avgRespTime = (totTime) / (long)iters;
avgThroughput =(float)( reqCnt * 1000) / (float) avgRespTime;
System.out.format("JRedisPipeline: %d GETs [%d bytes/GET] average response time @ %dms (%.2f ops/s) last: %dms\n", cnt, data.length, avgRespTime, avgThroughput, respDoneTime);
// Assert.isEquivalent(data, value);
}
iters ++;
// System.out.println ();
} while(forever);
pipeline.quit();
}
catch (ProviderException e) {
e.printStackTrace();
}
catch (InterruptedException e) {