同时执行多个命令的Redis性能测试到底多简单
一、服务器环境二、Redis 之 redis-benchmark
redis 提供了 redis-benchmark 工具便于我们做性能测试,可以使用 redis-benchmark- h 查看参数。
三、Docker Redis测试
单并发测试
测试命令
./redis-benchmark -c 1 -n 20000 -d 30720 -t set,get测试结果每秒是 8000+的QPS
多并发测试
假设 10并发,20000个请求,每次请求数据包大小为 30KB,只进行set和get测试。
./redis-benchmark -c 10 -n 20000 -d 30720 -t set,get====== SET ======
20000 requests completed in 1.06 seconds
10 parallel clients
30720 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= 0.1 milliseconds
0.12% <= 0.2 milliseconds
96.42% <= 0.3 milliseconds
99.69% <= 0.4 milliseconds
99.79% <= 0.5 milliseconds
99.84% <= 0.6 milliseconds
99.86% <= 0.7 milliseconds
99.88% <= 0.8 milliseconds
99.89% <= 0.9 milliseconds
99.90% <= 1.1 milliseconds
99.93% <= 3 milliseconds
99.96% <= 141 milliseconds
99.97% <= 142 milliseconds
100.00% <= 142 milliseconds
18903.59 requests per second====== GET ======
20000 requests completed in 1.30 seconds
10 parallel clients
30720 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
100.00% <= 0 milliseconds
15360.98 requests per second可以看到 set 每秒可以处理 18903.59 个请求,get 可以处理 15360.98 个请求。
接下来测试 -P 命令
20000个请求,每次请求数据包大小为 30KB,只进行set和get测试。
./redis-benchmark -n 20000-P 10 -d 30720 -t set,get ====== SET ======
20007 requests completed in 0.47 seconds
50 parallel clients
30720 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= 0.9 milliseconds
0.16% <= 1.0 milliseconds
2.28% <= 1.1 milliseconds
12.84% <= 1.2 milliseconds
27.49% <= 1.3 milliseconds
52.28% <= 1.4 milliseconds
78.03% <= 1.5 milliseconds
89.83% <= 1.6 milliseconds
93.50% <= 1.7 milliseconds
94.75% <= 1.8 milliseconds
95.25% <= 1.9 milliseconds
95.65% <= 2 milliseconds
96.86% <= 3 milliseconds
97.40% <= 4 milliseconds
97.96% <= 5 milliseconds
98.25% <= 6 milliseconds
98.56% <= 7 milliseconds
99.15% <= 8 milliseconds
99.46% <= 9 milliseconds
99.65% <= 10 milliseconds
100.00% <= 10 milliseconds
42933.48 requests per second====== GET ======
20002 requests completed in 0.44 seconds
50 parallel clients
30720 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= 1 milliseconds
0.31% <= 2 milliseconds
25.25% <= 3 milliseconds
65.50% <= 4 milliseconds
89.46% <= 5 milliseconds
96.71% <= 6 milliseconds
97.50% <= 8 milliseconds
97.75% <= 9 milliseconds
98.31% <= 10 milliseconds
98.81% <= 11 milliseconds
99.25% <= 13 milliseconds
99.61% <= 14 milliseconds
100.00% <= 14 milliseconds
45253.39 requests per second四、redis6 安装版测试
单并发测试 ./redis-benchmark --dbnum 1 -t set,get -c 1 -n 200000====== SET ======
200000 requests completed in 20.20 seconds
1 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
88.49% <= 0.1 milliseconds
99.98% <= 0.2 milliseconds
99.99% <= 0.3 milliseconds
100.00% <= 0.4 milliseconds
9900.01 requests per second====== GET ======
200000 requests completed in 20.01 seconds
1 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
88.37% <= 0.1 milliseconds
99.99% <= 0.2 milliseconds
99.99% <= 0.3 milliseconds
100.00% <= 0.4 milliseconds
9995.50 requests per second多并发测试
测试命令
./redis-benchmark --dbnum 1 -t set,get -c 10 -n 200000====== SET ======
200000 requests completed in 3.00 seconds
10 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
73.58% <= 0.1 milliseconds
99.72% <= 0.2 milliseconds
99.90% <= 0.3 milliseconds
99.93% <= 0.4 milliseconds
99.96% <= 0.5 milliseconds
99.98% <= 0.6 milliseconds
99.98% <= 0.8 milliseconds
99.99% <= 0.9 milliseconds
99.99% <= 1.2 milliseconds
99.99% <= 1.3 milliseconds
99.99% <= 1.4 milliseconds
100.00% <= 1.6 milliseconds
100.00% <= 2 milliseconds
100.00% <= 2 milliseconds
66622.25 requests per second ====== GET ======
200000 requests completed in 3.02 seconds
10 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
100.00% <= 1 milliseconds
100.00% <= 1 milliseconds
66137.57 requests per second-P 测试
单并发测试
./redis-benchmark --dbnum 1 -t set,get -c 1 -n 200000 -P 10====== SET ======
200000 requests completed in 2.20 seconds
1 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
72.01% <= 0.1 milliseconds
99.98% <= 0.2 milliseconds
100.00% <= 0.3 milliseconds
100.00% <= 0.3 milliseconds
90991.81 requests per second====== GET ======
200000 requests completed in 2.15 seconds
1 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
81.53% <= 0.1 milliseconds
99.99% <= 0.2 milliseconds
100.00% <= 0.3 milliseconds
100.00% <= 0.3 milliseconds
92980.01 requests per second多并发测试
./redis-benchmark --dbnum 1 -t set,get -c 10 -n 200000 -P 10====== SET ======
200010 requests completed in 0.42 seconds
10 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
3.15% <= 0.1 milliseconds
67.35% <= 0.2 milliseconds
99.33% <= 0.3 milliseconds
99.66% <= 0.4 milliseconds
99.88% <= 0.5 milliseconds
99.92% <= 0.6 milliseconds
99.92% <= 0.9 milliseconds
99.94% <= 1.0 milliseconds
99.95% <= 2 milliseconds
99.98% <= 3 milliseconds
100.00% <= 3 milliseconds
480793.25 requests per second====== GET ======
200000 requests completed in 0.34 seconds
10 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 900 1 300 10 60 10000
host configuration "appendonly": no
multi-thread: no
100.00% <= 0 milliseconds
586510.25 requests per second
支持分享
页:
[1]