標籤: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 helpUsage: redis-load ... options ......
一個簡單的測試例子:
$ ./redis-load host 127.0.0.1 port 6379PRNG 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 ms100.00% < 26 ms
4 redis-stat
redis-stat是即時監控Redis執行個體的狀態,包括overview、vmstat、vmpage、ondisk-size、latency,具體資訊如下:
$ ./redis-stat helpUsage: 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 ms2: 0.67 ms3: 0.21 ms4: 0.23 ms5: 0.23 ms6: 0.16 ms7: 0.37 ms......
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
Redis相關的小工具:redis-load、redis-stat