引自:
redis-benchmark為redis效能測試工具。
指令說明:
usage: redis-benchmark [-h ] [-p ] [-c ] [-n [-k ]
-h server hostname (default 127.0.0.1)
-p server port (default 6379)
-s server socket (overrides host and port)
-c number of parallel connections (default 50)
-n total number of requests (default 10000)
-d data size of set/get value in bytes (default 2)
-k 1=keep alive 0=reconnect (default 1)
-r 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 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 pipeline requests. default 1 (no pipeline).
-q quiet. just show query/sec values 只顯示每秒鐘能處理多少請求數結果
--csv output in csv format
-l loop. run the tests forever 永久測試
-t 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 127.0.0.1 -p 6379 -q -d 100
set/get 100 bytes 檢測host為127.0.0.1 埠為6379的redis伺服器效能
redis-benchmark -h 127.0.0.1 -p 6379 -c 5000 -n 100000
5000個併發連線,100000個請求,檢測host為127.0.0.1 埠為6379的redis伺服器效能
benchmark工具測試資訊:
測試命令:
redis-benchmark -n 100000 -c 60
向redis伺服器傳送100000個請求,每個請求附帶60個併發客戶端
結果(部分):
*****= set *****=
對集合寫入測試
100000 requests completed in 2.38 seconds
100000個請求在2.38秒內完成
60 parallel clients
每次請求有60個併發客戶端
3 bytes payload
每次寫入3個位元組的資料
keep alive: 1
保持乙個連線,一台伺服器來處理這些請求
93.06% <= 15 milliseconds
99.96% <= 31 milliseconds
99.98% <= 46 milliseconds
99.99% <= 62 milliseconds
100.00% <= 62 milliseconds
所有請求在62毫秒內完成
42105.26 requests per second
每秒處理42105.26次請求
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6379 -c 5000 -n 100000 -d 100 -q
ping_inline: 34506.55 requests per second
ping_bulk: 34059.95 requests per second
set: 31959.09 requests per second
get: 31466.33 requests per second
incr: 33311.12 requests per second
lpush: 29265.44 requests per second
lpop: 36968.58 requests per second
sadd: 32030.75 requests per second
spop: 33344.45 requests per second
lpush (needed to benchmark lrange): 29735.36 requests per second
lrange_100 (first 100 elements): 16116.04 requests per second
lrange_300 (first 300 elements): 6659.56 requests per second
lrange_500 (first 450 elements): 4108.29 requests per second
Redis benchmark使用總結
redis benchmark為redis效能測試工具。指令說明 usage redis benchmark h p c n k h server hostname default 127.0.0.1 p server port default 6379 s server socket overri...
redis benchmark 限流控制
由於自帶的redis benchmark不能按照設定的tps執行,因此增加tps控制功能。x t t tps 1 t x tps t 其中,x表示處理的請求數,t表示處理x筆請求花費的時間,t 表示需要等待的時間,tps表示設定的tps值利用redis benchmark中自帶的時間事件實現 int...
Redis benchmark測試Redis效能
redis benchmark是官方自帶的redis效能測試工具,可以有效的測試redis服務的效能。使用說明如下 usage redis benchmark h p c n k h server hostname default 127.0.0.1 p server port default 63...