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

Redis相关的小工具:redis-load、redis-stat

时间:2015-08-04 19:26:46      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:redis   监控工具   压力测试   

redis-load、redis-stat是Redis作者antirez写的两个小工具,其中:

  • redis-load是Redis的一个压力测试工具
  • redis-stat是Redis的状态监控工具

相关代码见:https://github.com/antirez/redis-tools

1 下载代码

$ git clone https://github.com/antirez/redis-tools.git

2 编译

$ cd redis-tools
$ make all

3 redis-load

redis-load是Redis压力测试工具,可以通过下面的方式查看具体用法:

$ ./redis-load help
Usage: redis-load ... options ...
...

一个简单的测试例子:

$ ./redis-load host 127.0.0.1 port 6379
PRNG seed is: 3312712080 - use the ‘seed‘ option to reproduce the same sequence
====== Report ======
  10000 requests in 0.367 seconds
  27247.96 requests per second
  50 parallel clients
  payload: 1..64 bytes
  keep alive: 1

  4.30% < 1 ms
 79.07% < 2 ms
 93.99% < 3 ms
 98.53% < 4 ms
 99.02% < 5 ms
 99.24% < 6 ms
 99.45% < 8 ms
 99.50% < 9 ms
 99.54% < 16 ms
 99.58% < 17 ms
 99.63% < 18 ms
 99.66% < 19 ms
 99.72% < 20 ms
 99.78% < 21 ms
 99.84% < 22 ms
 99.90% < 23 ms
 99.93% < 24 ms
 99.95% < 25 ms
100.00% < 26 ms

4 redis-stat

redis-stat是实时监控Redis实例的状态,包括overview、vmstat、vmpage、ondisk-size、latency,具体信息如下:

$ ./redis-stat help
Usage: redis-stat <type> ... options ...

Statistic types:
 overview (default)   Print general information about a Redis instance.
 vmstat               Print information about Redis VM activity.
 vmpage               Try to guess the best vm-page-size for your dataset.
 ondisk-size          Stats and graphs about values len once stored on disk.
 latency              Measure Redis server latency.

Options:
 host <hostname>      Server hostname (default 127.0.0.1)
 port <hostname>      Server port (default 6379)
 delay <milliseconds> Delay between requests (default: 1000 ms, 1 second).
 samplesize <keys>    Number of keys to sample for ‘vmpage‘ stat.
 logscale             User power-of-two logarithmic scale in graphs.

一个简单的测试例子:

$ ./redis-stat host 127.0.0.1 port 6379
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections          
29602      3.45M    1       0       30090 (+0)          157         
29602      3.45M    1       0       30091 (+1)          157         
29602      3.45M    1       0       30092 (+1)          157         
29602      3.45M    1       0       30093 (+1)          157         
29602      3.45M    1       0       30094 (+1)          157         
29602      3.45M    1       0       30095 (+1)          157         
29602      3.45M    1       0       30096 (+1)          157         
29602      3.45M    1       0       30097 (+1)          157         
29602      3.45M    1       0       30098 (+1)          157
...
...

查看Redis实例的实时的latency也非常有用:

$ ./redis-stat latency host 127.0.0.1 port 6379 
1: 0.23 ms
2: 0.67 ms
3: 0.21 ms
4: 0.23 ms
5: 0.23 ms
6: 0.16 ms
7: 0.37 ms
...
...

版权声明:本文为博主原创文章,未经博主允许不得转载。

Redis相关的小工具:redis-load、redis-stat

标签:redis   监控工具   压力测试   

原文地址:http://blog.csdn.net/cjfeii/article/details/47279591

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