简单使用
liqiangdeMacBook-Pro:rediscluster liqiang$ redis-benchmark -h 127.0.0.1 -p 6379 -c 1 -q //1个客户端进行测试 -q简化输出
#各个命令的tps测试 PING_INLINE: 31357.79 requests per second PING_BULK: 32020.49 requests per second SET: 21017.23 requests per second GET: 31645.57 requests per second INCR: 21335.61 requests per second LPUSH: 20686.80 requests per second RPUSH: 20644.10 requests per second LPOP: 20924.88 requests per second RPOP: 21110.41 requests per second SADD: 30940.59 requests per second HSET: 20255.22 requests per second SPOP: 30826.14 requests per second LPUSH (needed to benchmark LRANGE): 20052.13 requests per second LRANGE_100 (first 100 elements): 15260.19 requests per second LRANGE_300 (first 300 elements): 8010.90 requests per second LRANGE_500 (first 450 elements): 6196.17 requests per second LRANGE_600 (first 600 elements): 4443.06 requests per second MSET (10 keys): 16134.24 requests per second
只执行某些测试用例
-t指定 执行哪些用例
liqiangdeMacBook-Pro:rediscluster liqiang$ redis-benchmark -h 127.0.0.1 -p 6379 -c 1 -q -t set,lpush SET: 20964.36 requests per second LPUSH: 20618.56 requests per second
直接指定命令
liqiangdeMacBook-Pro:rediscluster liqiang$ redis-benchmark -h 127.0.0.1 -p 6379 -c 1 -q script load "redis.call('set','foo','bar')"
script load redis.call('set','foo','bar'): 20811.65 requests per second
不同key测试
-r 多少个随机key -n为set多少次 -t为只测set
liqiangdeMacBook-Pro:rediscluster liqiang$ redis-benchmark -h 127.0.0.1 -p 6379 -c 1 -r 10000 -n 100000 -t SET ====== SET ====== 100000 requests completed in 4.78 seconds 1 parallel clients 3 bytes payload keep alive: 1 100.00% <= 4 milliseconds 100.00% <= 11 milliseconds 100.00% <= 11 milliseconds 20903.01 requests per second
pipelining测试
-p 表示使用pipelining 1000条为一组测试
liqiangdeMacBook-Pro:rediscluster liqiang$ redis-benchmark -h 127.0.0.1 -p 6379 -c 1 -t set,get -P 1000 -q SET: 473933.66 requests per second GET: 1219512.12 requests per second