This topic describes the test environment, test tool, test method, and test results of an ApsaraDB for Redis performance test.
Test environment
Database
Item | Description |
Region and zone | Zone A in the China (Zhangjiakou) region |
Minor engine version | Redis 6.0.2.5 |
Instance architecture | Standard master-replica architecture for which the cluster mode is disabled. For more information, see Standard architecture. |
Instance specifications | The test results are only slightly affected by instance specifications. In this example, the 4 GB (redis.shard.large.ce) specification is used. For more information, see Specifications of ApsaraDB for Redis Community Edition instances. |
Test client
Item | Description |
Host of the client | Elastic Compute Service (ECS) instance of the ecs.g5ne.16xlarge instance type. For more information, see Overview of instance families. |
Region and zone | Zone A in the China (Zhangjiakou) region |
Operating system | CentOS 7.2 64-bit |
Network | The client is in the same virtual private cloud (VPC) as the Redis instance and is connected to the Redis instance over the VPC. |
Test tool
The redis-benchmark tool is used for stress testing. It is an official performance testing tool provided by Redis to effectively measure the performance of Redis. The redis-benchmark version used in this test is 7.2.0.
Procedure
Download the Redis source code on the ECS instance and compile the code to generate a redis-benchmark file and start the test. For more information, see Use redis-cli to connect to an ApsaraDB for Redis instance.
For example, to test the execution performance of the SET command, you can use the following sample command. The sample command executes the SET command by using 16 threads and 256 connections, and then generates 3,000,000 key-value pairs. Each value has a size of up to 64 bytes.
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 10000000 -c 256 -t set -d 64 --threads 16
Parameter | Description |
-h | The internal endpoint of the Redis instance. For more information, see View endpoints. |
-p | The service port of the Redis instance. Default value: 6379. |
-a | The password used to connect to the Redis instance. Note If you use an account created in the ApsaraDB for Redis console to connect to the Redis instance, the password must be in the |
-c | The number of concurrent connections. |
-n | The total number of requests tested. Set this parameter to a large value to ensure continuous stress testing. |
-t | The tested commands, such as SET and GET. |
-d | The data size of the value manipulated by a command such as SET. Unit: bytes. |
-r | The random range of keys that you want to use. This parameter specifies how many unique keys are used during the benchmarking test. |
--threads | Runs a multi-threaded stress test and specifies the number of threads. |
For more information about the parameters, see redis-benchmark.
Test results
This section describes the test metrics and test results of a performance test on more than a dozen basic commands of Redis such as SET and GET. The performance test is conducted in different scenarios with different numbers of threads and data sizes for write operations.
Test metrics
Test metric | Description |
QPS | The number of read and write operations that are processed per second. |
Latency | The average latency for a specific proportion of operations. Unit: milliseconds. |
99th Percentile Latency | The maximum latency of 99% of the operations. Unit: milliseconds. For example, a value of 0.5 indicates that 99% of requests can be processed within 0.5 milliseconds. |
Strings
GET
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t get -d 16 --threads 4 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
199653.94
0.483
0.959
128
187488.28
0.499
1.055
256
187195.81
0.514
1.015
1024
178826.91
0.544
1.071
2048
100677.90
0.966
1.487
SET
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t set -d 16 --threads 2 -c 150 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
133291.86
1.070
1.863
128
119779.61
1.196
2.039
256
107096.96
1.341
2.191
1024
84319.41
1.701
3.327
2048
54911.87
2.676
11.383
NoteThe maximum bandwidth of the instance type is 96 Mbit/s. This indicates that if the value length is 1,024 bytes, the maximum network bandwidth is reached.
MSET
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t mset -d 16 --threads 2 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
41120.11
2.364
5.167
INCR
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t incr --threads 2 -c 150 -n 3000000 -r 30000000
Results
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
146092.05
0.978
1.687
Lists
LPUSH
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t lpush -d 16 --threads 2 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
153830.38
0.623
1.191
128
142619.44
0.669
1.239
256
122249.38
0.782
1.431
1024
92267.95
1.082
1.775
LPOP
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t lpop -d 16 --threads 2 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
161908.36
0.601
1.143
128
155593.59
0.622
1.167
256
146106.27
0.664
1.239
1024
123492.37
0.786
1.407
RPUSH
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t rpush -d 16 --threads 2 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
153594.11
0.620
1.135
128
142626.22
0.668
1.247
256
127448.07
0.751
1.327
1024
93583.30
1.029
1.703
RPOP
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t rpop -d 16 --threads 2 -c 100 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
168719.42
0.576
1.127
128
164122.77
0.592
1.143
256
157637.53
0.611
1.167
1024
128816.18
0.755
1.367
Sets
SADD
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t sadd --threads 2 -c 150 -n 3000000 -r 30000000
Results
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
136134.67
1.045
1.735
SPOP
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t spop --threads 2 -c 150 -n 3000000 -r 30000000
Results
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
108053.59
1.329
2.383
Zsets
ZADD
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t zadd --threads 2 -c 150 -n 3000000 -r 30000000
Results
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
86770.40
1.654
2.423
ZPOPMIN
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t zpopmin --threads 2 -c 150 -n 3000000 -r 30000000
Results
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
104286.16
1.378
2.127
Hashes
HSET
Sample command:
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -t hset -d 16 --threads 2 -c 150 -n 3000000 -r 30000000
Results
Value length (bytes)
QPS
Average latency (milliseconds)
99th percentile latency (milliseconds)
16
121163.16
1.184
1.951
128
110905.73
1.291
2.023
256
105995.84
1.347
2.127
1024
76242.76
1.900
3.359