程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> DB2數據庫 >> DB2教程 >> Redis相關的小工具:redis-load、redis-stat

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

編輯:DB2教程

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


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  ... 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       Server hostname (default 127.0.0.1)
 port       Server port (default 6379)
 delay  Delay between requests (default: 1000 ms, 1 second).
 samplesize     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
...
...

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved