搭建了个主从复制模式的redis,进行性能测试之前需要以下操作:
1 配置LINUX参数优化:
sysctl.conf:
vm.overcommit_memory=1
vm.swappiness=0
/etc/security/limits.conf
* - nofile 1006154
设置max user processes为:
max user processes (-u) 46659
echo 511 > /proc/sys/net/core/somaxconn
测试命令:redis-benchmark -c 100 -n 20000
结果:
20000 requests completed in 0.21 seconds
100 parallel clients
3 bytes payload
keep alive: 1
65.98% <= 1 milliseconds
97.42% <= 2 milliseconds
99.50% <= 3 milliseconds
99.50% <= 4 milliseconds
99.91% <= 5 milliseconds
100.00% <= 5 milliseconds
94786.73 requests per second
====== PING_BULK ======
20000 requests completed in 0.19 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.07% <= 1 milliseconds
100.00% <= 1 milliseconds
104166.66 requests per second
====== SET ======
20000 requests completed in 0.17 seconds
100 parallel clients
3 bytes payload
keep alive: 1
98.85% <= 1 milliseconds
100.00% <= 1 milliseconds
114285.72 requests per second
====== GET ======
20000 requests completed in 0.18 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.76% <= 1 milliseconds
100.00% <= 1 milliseconds
109289.62 requests per second
====== INCR ======
20000 requests completed in 0.20 seconds
100 parallel clients
3 bytes payload
keep alive: 1
98.29% <= 1 milliseconds
99.76% <= 2 milliseconds
100.00% <= 2 milliseconds
99502.48 requests per second
====== LPUSH ======
20000 requests completed in 0.16 seconds
100 parallel clients
3 bytes payload
keep alive: 1
95.18% <= 1 milliseconds
100.00% <= 1 milliseconds
129032.26 requests per second
====== RPUSH ======
20000 requests completed in 0.16 seconds
100 parallel clients
3 bytes payload
keep alive: 1
100.00% <= 0 milliseconds
125786.16 requests per second
====== LPOP ======
20000 requests completed in 0.17 seconds
100 parallel clients
3 bytes payload
keep alive: 1
92.18% <= 1 milliseconds
100.00% <= 1 milliseconds
121212.12 requests per second
====== RPOP ======
20000 requests completed in 0.14 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.89% <= 1 milliseconds
100.00% <= 1 milliseconds
143884.89 requests per second
====== SADD ======
20000 requests completed in 0.15 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.96% <= 1 milliseconds
100.00% <= 1 milliseconds
136054.42 requests per second
====== SPOP ======
20000 requests completed in 0.16 seconds
100 parallel clients
3 bytes payload
keep alive: 1
97.76% <= 1 milliseconds
100.00% <= 1 milliseconds
123456.79 requests per second
====== LPUSH (needed to benchmark LRANGE) ======
20000 requests completed in 0.14 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.77% <= 1 milliseconds
100.00% <= 1 milliseconds
147058.81 requests per second
====== LRANGE_100 (first 100 elements) ======
20000 requests completed in 0.35 seconds
100 parallel clients
3 bytes payload
keep alive: 1
82.65% <= 1 milliseconds
99.04% <= 2 milliseconds
100.00% <= 3 milliseconds
100.00% <= 3 milliseconds
56657.23 requests per second
====== LRANGE_300 (first 300 elements) ======
20000 requests completed in 1.13 seconds
100 parallel clients
3 bytes payload
keep alive: 1
0.04% <= 1 milliseconds
1.20% <= 2 milliseconds
60.71% <= 3 milliseconds
95.00% <= 4 milliseconds
98.61% <= 5 milliseconds
99.32% <= 6 milliseconds
99.64% <= 7 milliseconds
99.96% <= 8 milliseconds
100.00% <= 8 milliseconds
17746.23 requests per second
====== LRANGE_500 (first 450 elements) ======
20000 requests completed in 2.00 seconds
100 parallel clients
3 bytes payload
keep alive: 1
0.01% <= 1 milliseconds
0.05% <= 2 milliseconds
3.03% <= 3 milliseconds
31.10% <= 4 milliseconds
56.16% <= 5 milliseconds
73.47% <= 6 milliseconds
85.69% <= 7 milliseconds
93.13% <= 8 milliseconds
96.82% <= 9 milliseconds
98.43% <= 10 milliseconds
99.14% <= 11 milliseconds
99.39% <= 12 milliseconds
99.60% <= 13 milliseconds
99.64% <= 14 milliseconds
99.67% <= 15 milliseconds
99.68% <= 16 milliseconds
99.71% <= 17 milliseconds
99.75% <= 18 milliseconds
99.78% <= 19 milliseconds
99.81% <= 20 milliseconds
99.83% <= 21 milliseconds
99.87% <= 22 milliseconds
99.92% <= 23 milliseconds
99.96% <= 24 milliseconds
100.00% <= 25 milliseconds
10005.00 requests per second
====== LRANGE_600 (first 600 elements) ======
20000 requests completed in 2.03 seconds
100 parallel clients
3 bytes payload
keep alive: 1
0.01% <= 1 milliseconds
0.08% <= 2 milliseconds
0.25% <= 3 milliseconds
9.85% <= 4 milliseconds
60.56% <= 5 milliseconds
82.31% <= 6 milliseconds
91.94% <= 7 milliseconds
95.78% <= 8 milliseconds
97.08% <= 9 milliseconds
97.71% <= 10 milliseconds
98.10% <= 11 milliseconds
98.31% <= 12 milliseconds
98.67% <= 13 milliseconds
98.98% <= 14 milliseconds
99.25% <= 15 milliseconds
99.38% <= 16 milliseconds
99.45% <= 17 milliseconds
99.71% <= 18 milliseconds
99.88% <= 19 milliseconds
99.99% <= 20 milliseconds
100.00% <= 20 milliseconds
9852.22 requests per second
====== MSET (10 keys) ======
20000 requests completed in 0.48 seconds
100 parallel clients
3 bytes payload
keep alive: 1
2.52% <= 1 milliseconds
43.22% <= 2 milliseconds
80.64% <= 3 milliseconds
95.00% <= 4 milliseconds
99.21% <= 5 milliseconds
99.65% <= 6 milliseconds
100.00% <= 7 milliseconds
41493.78 requests per second