Redis-benchmark使用总结

Redis-benchmark为Redis性能测试工具。

指令说明:

Usage: redis-benchmark [-h <host>] [-p <port>] [-c <clients>] [-n <requests]> [-k <boolean>]

-h <hostname>      Server hostname (default 127.0.0.1)
-p <port>          Server port (default 6379)
-s <socket>        Server socket (overrides host and port)
-c <clients>       Number of parallel connections (default 50)
-n <requests>      Total number of requests (default 10000)
-d <size>          Data size of SET/GET value in bytes (default 2)
-k <boolean>       1=keep alive 0=reconnect (default 1)
-r <keyspacelen>   Use random keys for SET/GET/INCR, random values for SADD
  Using this option the benchmark will get/set keys
  in the form mykey_rand:000000012456 instead of constant
  keys, the <keyspacelen> argument determines the max
  number of values for the random number. For instance
  if set to 10 only rand:000000000000 - rand:000000000009
  range will be allowed.
-P <numreq>        Pipeline <numreq> requests. Default 1 (no pipeline).
-q                 Quiet. Just show query/sec values 只显示每秒钟能处理多少请求数结果
--csv              Output in CSV format
-l                 Loop. Run the tests forever 永久测试
-t <tests>         Only run the comma separated list of tests. The test
                    names are the same as the ones produced as output.
-I                 Idle mode. Just open N idle connections and wait.


实例:

redis-benchmark -h 127.0.0.1 -p 6379 -q -d 100  
SET/GET 100 bytes 检测host为127.0.0.1 端口为6379的redis服务器性能


redis-benchmark -h 127.0.0.1 -p 6379 -c 5000 -n 100000 
5000个并发连接,100000个请求,检测host为127.0.0.1 端口为6379的redis服务器性能 




benchmark工具测试信息:
测试命令:
redis-benchmark -n 100000 -c 60
向redis服务器发送100000个请求,每个请求附带60个并发客户端
结果(部分):
====== SET ======
对集合写入测试
  100000 requests completed in 2.38 seconds
100000个请求在2.38秒内完成
  60 parallel clients
每次请求有60个并发客户端
  3 bytes payload
每次写入3个字节的数据
  keep alive: 1
保持一个连接,一台服务器来处理这些请求


93.06% <= 15 milliseconds
99.96% <= 31 milliseconds
99.98% <= 46 milliseconds
99.99% <= 62 milliseconds
100.00% <= 62 milliseconds
所有请求在62毫秒内完成
42105.26 requests per second
每秒处理42105.26次请求

单连接:

[root@local-idc-tcaplus-docker25 src]# redis-benchmark -h 10.10.40.26 -p 6379 -c 1 -n 10000 -q
PING_INLINE: 6544.50 requests per second, p50=0.135 msec                  
PING_MBULK: 5112.47 requests per second, p50=0.151 msec                  
SET: 6574.62 requests per second, p50=0.143 msec                  
GET: 4967.71 requests per second, p50=0.159 msec                  
INCR: 5133.47 requests per second, p50=0.151 msec                  
LPUSH: 5543.24 requests per second, p50=0.151 msec                  
RPUSH: 6765.90 requests per second, p50=0.135 msec                  
LPOP: 5249.34 requests per second, p50=0.159 msec                  
RPOP: 5780.35 requests per second, p50=0.151 msec                  
SADD: 5899.70 requests per second, p50=0.151 msec                  
HSET: 5608.52 requests per second, p50=0.151 msec                  
SPOP: 5434.78 requests per second, p50=0.151 msec                  
ZADD: 5030.18 requests per second, p50=0.167 msec                  
ZPOPMIN: 5099.44 requests per second, p50=0.151 msec                  
LPUSH (needed to benchmark LRANGE): 5452.56 requests per second, p50=0.143 msec                  
LRANGE_100 (first 100 elements): 4269.85 requests per second, p50=0.183 msec                  
LRANGE_300 (first 300 elements): 3827.02 requests per second, p50=0.207 msec                  
LRANGE_500 (first 500 elements): 2787.84 requests per second, p50=0.255 msec                  
LRANGE_600 (first 600 elements): 2723.31 requests per second, p50=0.271 msec                  
MSET (10 keys): 4812.32 requests per second, p50=0.159 msec 

多连接 50:

[root@local-idc-tcaplus-docker25 src]# redis-benchmark -h 10.10.40.26 -p 6379 -c 50 -n 10000 -q
PING_INLINE: 57471.27 requests per second, p50=0.551 msec          
PING_MBULK: 57142.86 requests per second, p50=0.543 msec                   
SET: 62500.00 requests per second, p50=0.527 msec                   
GET: 62893.08 requests per second, p50=0.527 msec
INCR: 60975.61 requests per second, p50=0.527 msec                   
LPUSH: 59171.60 requests per second, p50=0.543 msec                   
RPUSH: 60240.96 requests per second, p50=0.527 msec
LPOP: 64516.13 requests per second, p50=0.511 msec                   
RPOP: 70921.98 requests per second, p50=0.471 msec
SADD: 74626.87 requests per second, p50=0.455 msec                  
HSET: 73529.41 requests per second, p50=0.463 msec
SPOP: 71428.57 requests per second, p50=0.463 msec          
ZADD: 70422.53 requests per second, p50=0.479 msec                   
ZPOPMIN: 70921.98 requests per second, p50=0.463 msec
LPUSH (needed to benchmark LRANGE): 72463.77 requests per second, p50=0.471 msec                   
LRANGE_100 (first 100 elements): 40816.32 requests per second, p50=0.815 msec                   
LRANGE_300 (first 300 elements): 16611.29 requests per second, p50=1.703 msec                   
LRANGE_500 (first 500 elements): 11037.53 requests per second, p50=2.407 msec                   
LRANGE_600 (first 600 elements): 9587.73 requests per second, p50=2.703 msec                    
MSET (10 keys): 58479.53 requests per second, p50=0.567 msec   

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

流子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值