@Override protected void prep() { for(int i=0; i<reqCnt; i++) { try { jredis.sadd (key, i); } catch (RedisException e) { e.printStackTrace(); } } } @Override
@Override protected void prep() { for(int i=0; i<reqCnt; i++) { try { jredis.sadd (key, i); } catch (RedisException e) { e.printStackTrace(); } } } @Override
@Override protected void work() { for(int i=0; i<reqCnt; i++) { try { jredis.sadd (key, i); } catch (RedisException e) { e.printStackTrace(); } } } };
@Override protected void prep() { try { for(int i=0; i<values.size(); i++){ jredis.sadd (key, values.get(i)); } } catch (RedisException e) { e.printStackTrace(); } } @Override
private void elicitErrors () { String key = "foo" ; try { jredis.set(key, "bar"); jredis.sadd(key, "foobar"); } catch (RedisException e) { Log.log("Expected elicited error: %s", e.getMessage()); } }
/** * In a tight loop, we execute a few select * commands that touch the various permutations of * request complexity, and response type, so that * we can pinpoint the bottlenecks and the general * runtime characteristics of the JRedic provider. * @throws RedisException */ public void run () throws RedisException { Log.log("***** JProfileTestCase ****"); // jredis.auth("jredis").ping().flushall(); int iter = 100000; String key = "foostring"; String cntrkey = "foocntr"; String listkey = "foolist"; String setkey = "fooset"; byte[] data = "meow".getBytes(); long start = System.currentTimeMillis(); for(Long j=0L; j<iter; j++) { jredis.incr(cntrkey); jredis.set(key, data); jredis.sadd(setkey, data); jredis.rpush(listkey, data); } long delta = System.currentTimeMillis() - start; float rate = ((float)iter * 1000) / delta; System.out.format("%d iterations | %d msec | %8.2f /sec \n", iter, delta, rate); } }