测试环境&测试工具&测试方法
1、CVM规格
4C8G(三台机器作为redis client,同时压测)、CentOS 7.9 64位

2、Redis主从版本
架构:标准架构
版本:4.0
副本数量:1主1副本
内存容量:8G

3、Redis集群版本
架构:集群架构
版本:4.0
副本数量:1主2副本
内存容量:4分片2GB
4、Redis测试工具
redis-benchmark
安装方法:
1 | yum - y install redis.x86_64 |
5、Redis集群版本压测命令
1 | redis-benchmark -h host -p port -a password -t set -c 3500 -d 128 -n 25000000 -r 5000000 |
- -c Number of parallel connections (default 50)
- -d Data size of SET/GET value in bytes (default 3)
- -n Total number of requests (default 100000)
- -r Use random keys for SET/GET/INCR

注意,云服务器在连接redis时,需要放开reids的安全组,如下

6、Redis主从版本压测命令
1 | redis-benchmark -h host -p port -a password -t set -c 3500 -d 128 -n 25000000 -r 5000000 |
- -c Number of parallel connections (default 50)
- -d Data size of SET/GET value in bytes (default 3)
- -n Total number of requests (default 100000)
- -r Use random keys for SET/GET/INCR
Sets requests per second(收集三台client requests的总和)
====== SET ======
80 requests completed in 0.00 seconds
200 parallel clients
128 bytes payload
keep alive: 1
1.25% <= 1 milliseconds
100.00% <= 1 milliseconds
26666.67 requests per second3