1. 程式人生 > >redis壓力測試工具-----redis-benchmark

redis壓力測試工具-----redis-benchmark

push program first ive ogr bench body bsp pro

redis做壓測可以用自帶的redis-benchmark工具,使用簡單

技術分享圖片

壓測命令:redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000

技術分享圖片

壓測需要一段時間,因為它需要依次壓測多個命令的結果,如:get、set、incr、lpush等等,所以我們需要耐心等待,如果只需要壓測某個命令,如:get,那麽可以在以上的命令後加一個參數-t(紅色部分):

1、redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -t get

C:\Program Files\Redis>redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000 -t get

====== GET ======
10000 requests completed in 0.16 seconds
50 parallel clients
3 bytes payload
keep alive: 1

99.53% <= 1 milliseconds
100.00% <= 1 milliseconds
62893.08 requests per second

2、redis-benchmark -h 127.0.0.1 -p 6086 -c 50 -n 10000 -t set

C:\Program Files\Redis>redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000 -t set

====== SET ======
10000 requests completed in 0.18 seconds
50 parallel clients
3 bytes payload
keep alive: 1

87.76% <= 1 milliseconds
99.47% <= 2 milliseconds
99.51% <= 7 milliseconds
99.74% <= 8 milliseconds
100.00% <= 8 milliseconds
56179.77 requests per second

這樣看起來數據很多,如果我們只想看最終的結果,可以帶上參數-q,完整的命令如下:

3、redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000 -q

C:\Program Files\Redis>redis-benchmark -h 127.0.0.1 -p 6379 -c 50 -n 10000 -q
PING_INLINE: 63291.14 requests per second
PING_BULK: 62500.00 requests per second
SET: 49261.09 requests per second
GET: 47619.05 requests per second
INCR: 42194.09 requests per second
LPUSH: 61349.69 requests per second
RPUSH: 56818.18 requests per second
LPOP: 47619.05 requests per second
RPOP: 45045.04 requests per second
SADD: 46296.30 requests per second
SPOP: 59523.81 requests per second
LPUSH (needed to benchmark LRANGE): 56818.18 requests per second
LRANGE_100 (first 100 elements): 32362.46 requests per second
LRANGE_300 (first 300 elements): 13315.58 requests per second
LRANGE_500 (first 450 elements): 10438.41 requests per second
LRANGE_600 (first 600 elements): 8591.07 requests per second
MSET (10 keys): 55248.62 requests per second

redis壓力測試工具-----redis-benchmark