码迷,mamicode.com
首页 > 其他好文 > 详细

Redis-benchmark测试Redis性能

时间:2015-05-19 18:43:51      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:

Redis-benchmark是官方自带的Redis性能测试工具,可以有效的测试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.


测试命令事例:

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

2、redis-benchmark -h 192.168.1.201 -p 6379 -q -d 100  

测试存取大小为100字节的数据包的性能

3、redis-benchmark -t set,lpush -n 100000 -q

只测试某些操作的性能

4、redis-benchmark -n 100000 -q script load "redis.call(‘set‘,‘foo‘,‘bar‘)"

只测试某些数值存取的性能

 

测试结果分析:

  10000 requests completed in 0.30 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.11% <= 1 milliseconds
86.00% <= 2 milliseconds
90.12% <= 3 milliseconds
96.68% <= 4 milliseconds
99.27% <= 5 milliseconds
99.54% <= 6 milliseconds
99.69% <= 7 milliseconds
99.78% <= 8 milliseconds
99.89% <= 9 milliseconds
100.00% <= 9 milliseconds
33222.59 requests per second

====== PING_BULK ======
  10000 requests completed in 0.27 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.93% <= 1 milliseconds
97.66% <= 2 milliseconds
100.00% <= 2 milliseconds
37174.72 requests per second

====== SET ======
  10000 requests completed in 0.32 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.22% <= 1 milliseconds
91.68% <= 2 milliseconds
97.78% <= 3 milliseconds
98.80% <= 4 milliseconds
99.38% <= 5 milliseconds
99.61% <= 6 milliseconds
99.72% <= 7 milliseconds
99.83% <= 8 milliseconds
99.94% <= 9 milliseconds
100.00% <= 9 milliseconds
30959.75 requests per second

====== GET ======
  10000 requests completed in 0.28 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.55% <= 1 milliseconds
98.86% <= 2 milliseconds
100.00% <= 2 milliseconds
35971.22 requests per second

====== INCR ======
  10000 requests completed in 0.14 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

95.61% <= 1 milliseconds
100.00% <= 1 milliseconds
69444.45 requests per second

====== LPUSH ======
  10000 requests completed in 0.21 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

18.33% <= 1 milliseconds
100.00% <= 1 milliseconds
48309.18 requests per second

====== LPOP ======
  10000 requests completed in 0.23 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.29% <= 1 milliseconds
99.76% <= 2 milliseconds
100.00% <= 2 milliseconds
44052.86 requests per second

====== SADD ======
  10000 requests completed in 0.22 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

2.37% <= 1 milliseconds
99.81% <= 2 milliseconds
100.00% <= 2 milliseconds
44444.45 requests per second

====== SPOP ======
  10000 requests completed in 0.22 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

4.27% <= 1 milliseconds
99.84% <= 2 milliseconds
100.00% <= 2 milliseconds
44642.86 requests per second

====== LPUSH (needed to benchmark LRANGE) ======
  10000 requests completed in 0.22 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

12.35% <= 1 milliseconds
99.62% <= 2 milliseconds
100.00% <= 2 milliseconds
46082.95 requests per second

====== LRANGE_100 (first 100 elements) ======
  10000 requests completed in 0.48 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.01% <= 1 milliseconds
3.27% <= 2 milliseconds
98.71% <= 3 milliseconds
99.93% <= 4 milliseconds
100.00% <= 4 milliseconds
20964.36 requests per second

====== LRANGE_300 (first 300 elements) ======
  10000 requests completed in 1.26 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.01% <= 2 milliseconds
0.14% <= 3 milliseconds
0.90% <= 4 milliseconds
7.03% <= 5 milliseconds
31.68% <= 6 milliseconds
78.93% <= 7 milliseconds
98.88% <= 8 milliseconds
99.56% <= 9 milliseconds
99.72% <= 10 milliseconds
99.95% <= 11 milliseconds
100.00% <= 11 milliseconds
7961.78 requests per second

====== LRANGE_500 (first 450 elements) ======
  10000 requests completed in 1.82 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.01% <= 2 milliseconds
0.06% <= 3 milliseconds
0.14% <= 4 milliseconds
0.30% <= 5 milliseconds
0.99% <= 6 milliseconds
2.91% <= 7 milliseconds
8.11% <= 8 milliseconds
43.15% <= 9 milliseconds
88.38% <= 10 milliseconds
97.25% <= 11 milliseconds
98.61% <= 12 milliseconds
99.26% <= 13 milliseconds
99.30% <= 14 milliseconds
99.44% <= 15 milliseconds
99.48% <= 16 milliseconds
99.64% <= 17 milliseconds
99.85% <= 18 milliseconds
99.92% <= 19 milliseconds
99.95% <= 20 milliseconds
99.96% <= 21 milliseconds
99.97% <= 22 milliseconds
100.00% <= 23 milliseconds
5491.49 requests per second

====== LRANGE_600 (first 600 elements) ======
  10000 requests completed in 2.29 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.01% <= 2 milliseconds
0.05% <= 3 milliseconds
0.10% <= 4 milliseconds
0.19% <= 5 milliseconds
0.34% <= 6 milliseconds
0.46% <= 7 milliseconds
0.58% <= 8 milliseconds
4.46% <= 9 milliseconds
21.80% <= 10 milliseconds
40.48% <= 11 milliseconds
60.14% <= 12 milliseconds
79.81% <= 13 milliseconds
93.77% <= 14 milliseconds
97.14% <= 15 milliseconds
98.67% <= 16 milliseconds
99.08% <= 17 milliseconds
99.30% <= 18 milliseconds
99.41% <= 19 milliseconds
99.52% <= 20 milliseconds
99.61% <= 21 milliseconds
99.79% <= 22 milliseconds
99.88% <= 23 milliseconds
99.89% <= 24 milliseconds
99.95% <= 26 milliseconds
99.96% <= 27 milliseconds
99.97% <= 28 milliseconds
99.98% <= 29 milliseconds
100.00% <= 29 milliseconds
4359.20 requests per second

====== MSET (10 keys) ======
  10000 requests completed in 0.37 seconds
  100 parallel clients
  3 bytes payload
  keep alive: 1

0.01% <= 1 milliseconds
2.00% <= 2 milliseconds
18.41% <= 3 milliseconds
88.55% <= 4 milliseconds
96.09% <= 5 milliseconds
99.50% <= 6 milliseconds
99.65% <= 7 milliseconds
99.75% <= 8 milliseconds
99.77% <= 9 milliseconds
99.78% <= 11 milliseconds
99.79% <= 12 milliseconds
99.80% <= 13 milliseconds
99.81% <= 15 milliseconds
99.82% <= 16 milliseconds
99.83% <= 17 milliseconds
99.84% <= 19 milliseconds
99.85% <= 21 milliseconds
99.86% <= 23 milliseconds
99.87% <= 24 milliseconds
99.88% <= 25 milliseconds
99.89% <= 27 milliseconds
99.90% <= 28 milliseconds
99.91% <= 30 milliseconds
99.92% <= 32 milliseconds
99.93% <= 34 milliseconds
99.95% <= 35 milliseconds
99.96% <= 36 milliseconds
99.97% <= 37 milliseconds
99.98% <= 39 milliseconds
99.99% <= 41 milliseconds
100.00% <= 41 milliseconds
27173.91 requests per second

 

Redis-benchmark测试Redis性能

标签:

原文地址:http://www.cnblogs.com/silent2012/p/4514901.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!