redis-benchmark 位于src目录下,是redis自带的压测工具,使用简单方便;
[root@xxxx]# redis-benchmark -p 8200 -c 50 -n 100000 # 50并发,10W的请求量;
====== PING_INLINE ====== # ping\r\nping\r\nping\r\n.
100000 requests completed in 1.53 seconds # 1.53s完成10W的请求
50 parallel clients # 50并发
3 bytes payload # 3bytes每次请求
keep alive: 1 # 单机模式
host configuration "save": 3600 1 300 100 60 10000 #save的配置
host configuration "appendonly": yes # AOF模式
multi-thread: no # 未开启mutl-thread
Latency by percentile distribution: #每次分发一定百分比的延时
0.000% <= 0.087 milliseconds (cumulative count 1)
50.000% <= 0.335 milliseconds (cumulative count 55451) #每次分发一定百分比所对应的延时
75.000% <= 0.543 milliseconds (cumulative count 77491)
87.500% <= 0.559 milliseconds (cumulative count 87688)
93.750% <= 0.575 milliseconds (cumulative count 94537)
96.875% <= 0.599 milliseconds (cumulative count 97281)
98.438% <= 0.631 milliseconds (cumulative count 98528)
99.219% <= 0.671 milliseconds (cumulative count 99242)
99.609% <= 0.767 milliseconds (cumulative count 99627)
99.805% <= 0.975 milliseconds (cumulative count 99805)
99.902% <= 1.647 milliseconds (cumulative count 99903)
99.951% <= 1.703 milliseconds (cumulative count 99954)
99.976% <= 1.879 milliseconds (cumulative count 99976)
99.988% <= 1.999 milliseconds (cumulative count 99988)
99.994% <= 2.055 milliseconds (cumulative count 99994)
99.997% <= 2.095 milliseconds (cumulative count 99998)
99.998% <= 2.111 milliseconds (cumulative count 99999)
99.999% <= 2.119 milliseconds (cumulative count 100000)
100.000% <= 2.119 milliseconds (cumulative count 100000)
Cumulative distribution of latencies: #分发一定百分比的累计延时;
0.002% <= 0.103 milliseconds (cumulative count 2)
......
100.000% <= 3.103 milliseconds (cumulative count 100000) #分发完所有请求的总延时
Summary:
throughput summary: 65189.05 requests per second #6.5W QPS
latency summary (msec):
avg min p50 p95 p99 max
0.399 0.080 0.335 0.583 0.655 2.119
#平均延时,最小延时,50%、95%、99%的延时,以及最大延时
后续会分别进行SET、GET、INCR等命令的压测;
====== PING_INLINE ======
throughput summary: 65189.05 requests per second
====== PING_MBULK ======
throughput summary: 68493.15 requests per second
====== SET ======
throughput summary: 71326.68 requests per second
====== GET ======
throughput summary: 68775.79 requests per second
====== INCR ======
throughput summary: 71994.23 requests per second
====== LPUSH ======
throughput summary: 65789.48 requests per second
====== RPUSH ======
throughput summary: 65231.57 requests per second
====== LPOP ======
throughput summary: 65919.58 requests per second
====== RPOP ======
throughput summary: 65832.78 requests per second
====== SADD ======
throughput summary: 64516.13 requests per second
====== HSET ======
throughput summary: 69060.77 requests per second
====== SPOP ======
throughput summary: 65316.79 requests per second
====== ZADD ======
throughput summary: 68027.21 requests per second
====== ZPOPMIN ======
throughput summary: 67114.09 requests per second
====== LPUSH (needed to benchmark LRANGE) ======
throughput summary: 71275.84 requests per second
====== LRANGE_100 (first 100 elements) ======
throughput summary: 34317.09 requests per second
====== LRANGE_300 (first 300 elements) ======
throughput summary: 18145.53 requests per second