redis状态与性能监控

1.  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 localhost -p 6379 -c 100 -n 100000

 100个并发连接,100000个请求,检测host为localhost端口为6379的redis服务器的性能。

 

====== PING_INLINE ======  
  100000 requests completed in 1.13 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
44.60% <= 1 milliseconds  
100.00% <= 1 milliseconds  
88105.73 requests per second  
  
====== PING_BULK ======  
  100000 requests completed in 1.13 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
40.55% <= 1 milliseconds  
99.94% <= 2 milliseconds  
100.00% <= 2 milliseconds  
88261.25 requests per second  
  
====== SET ======  
  100000 requests completed in 1.16 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
46.39% <= 1 milliseconds  
99.90% <= 2 milliseconds  
99.98% <= 3 milliseconds  
100.00% <= 3 milliseconds  
86058.52 requests per second  
  
====== GET ======  
  100000 requests completed in 1.16 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
55.14% <= 1 milliseconds  
99.87% <= 2 milliseconds  
100.00% <= 2 milliseconds  
86058.52 requests per second  
  
====== INCR ======  
  100000 requests completed in 1.16 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
51.43% <= 1 milliseconds  
99.70% <= 2 milliseconds  
99.89% <= 3 milliseconds  
99.92% <= 4 milliseconds  
100.00% <= 4 milliseconds  
86505.19 requests per second  
  
====== LPUSH ======  
  100000 requests completed in 1.14 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
36.27% <= 1 milliseconds  
99.90% <= 2 milliseconds  
100.00% <= 2 milliseconds  
87565.68 requests per second  
  
====== LPOP ======  
  100000 requests completed in 1.13 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
49.68% <= 1 milliseconds  
100.00% <= 1 milliseconds  
88731.15 requests per second  
  
====== SADD ======  
  100000 requests completed in 1.13 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
37.29% <= 1 milliseconds  
100.00% <= 1 milliseconds  
88105.73 requests per second  
  
====== SPOP ======  
  100000 requests completed in 1.11 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
42.64% <= 1 milliseconds  
99.89% <= 2 milliseconds  
99.90% <= 4 milliseconds  
99.92% <= 5 milliseconds  
100.00% <= 5 milliseconds  
90090.09 requests per second  
  
====== LPUSH (needed to benchmark LRANGE) ======  
  100000 requests completed in 1.14 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
46.04% <= 1 milliseconds  
100.00% <= 2 milliseconds  
100.00% <= 2 milliseconds  
87950.75 requests per second  
  
====== LRANGE_100 (first 100 elements) ======  
  100000 requests completed in 4.64 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
0.01% <= 1 milliseconds  
2.07% <= 2 milliseconds  
99.65% <= 3 milliseconds  
99.96% <= 4 milliseconds  
100.00% <= 4 milliseconds  
21565.67 requests per second  
  
====== LRANGE_300 (first 300 elements) ======  
  100000 requests completed in 9.80 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
0.00% <= 1 milliseconds  
0.01% <= 2 milliseconds  
0.09% <= 3 milliseconds  
8.02% <= 4 milliseconds  
56.57% <= 5 milliseconds  
95.73% <= 6 milliseconds  
99.88% <= 7 milliseconds  
99.97% <= 8 milliseconds  
100.00% <= 9 milliseconds  
10206.16 requests per second  
  
====== LRANGE_500 (first 450 elements) ======  
  100000 requests completed in 13.50 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
0.00% <= 1 milliseconds  
0.01% <= 2 milliseconds  
0.05% <= 3 milliseconds  
2.07% <= 4 milliseconds  
17.32% <= 5 milliseconds  
37.14% <= 6 milliseconds  
54.99% <= 7 milliseconds  
73.80% <= 8 milliseconds  
92.84% <= 9 milliseconds  
99.52% <= 10 milliseconds  
99.94% <= 11 milliseconds  
99.98% <= 12 milliseconds  
99.99% <= 13 milliseconds  
100.00% <= 13 milliseconds  
7409.60 requests per second  
  
====== LRANGE_600 (first 600 elements) ======  
  100000 requests completed in 17.67 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
0.00% <= 1 milliseconds  
0.01% <= 2 milliseconds  
0.03% <= 3 milliseconds  
0.04% <= 4 milliseconds  
0.44% <= 5 milliseconds  
5.83% <= 6 milliseconds  
19.29% <= 7 milliseconds  
35.08% <= 8 milliseconds  
52.45% <= 9 milliseconds  
71.43% <= 10 milliseconds  
88.77% <= 11 milliseconds  
98.23% <= 12 milliseconds  
99.73% <= 13 milliseconds  
99.93% <= 14 milliseconds  
99.98% <= 15 milliseconds  
99.98% <= 16 milliseconds  
99.99% <= 17 milliseconds  
100.00% <= 18 milliseconds  
5658.03 requests per second  
  
====== MSET (10 keys) ======  
  100000 requests completed in 1.77 seconds  
  100 parallel clients  
  3 bytes payload  
  keep alive: 1  
  
1.92% <= 1 milliseconds  
61.83% <= 2 milliseconds  
99.23% <= 3 milliseconds  
99.90% <= 5 milliseconds  
99.94% <= 6 milliseconds  
100.00% <= 6 milliseconds  
56433.41 requests per second

 可见,redis服务器的get和set操作每秒处理请求为86000,性能很高,LRANGE操作相比而言性能较低,和要操作的元素数量有关。

 

2.  redis-stat

redis-stat host localhost port 6379 overview

Print general information about a Redis instance; 
实时打印出host为localhost,端口为6379,redis实例的总体信息.

 

redis-stat host localhost port 6379 latency
Measure Redis server latency; 
输出host为localhost,端口为6379,redis服务中每个请求的响应时长.

你可能感兴趣的:(redis)