This topic describes the method, environment, and tool that are used to test the performance of a Redis 6.0-compatible Tair DRAM-based instance and provides the test results.
Overview
Tair DRAM-based instances are suitable for scenarios that involve high concurrency and a large number of read and write operations. DRAM-based instances provide more benefits than ApsaraDB for Redis Community Edition instances.
- DRAM-based instances use the multi-threading model. A DRAM-based instance provides the read and write performance approximately three times that of an ApsaraDB for Redis Community Edition instance with the same specifications.
- DRAM-based instances provide multiple enhanced data modules, including TairString (including CAS and CAD commands), TairHash, TairGIS, TairBloom, TairDoc, TairTS, TairCpc, TairZset, TairRoaring, TairVector, and TairSearch. These modules eliminate your worries about data structures and timeliness for storage and allow you to focus on application development.
For more information, see DRAM-based instances.
Test environment
Database
Environment-related item | Description |
---|---|
Region and zone | Zone A in the China (Zhangjiakou) region |
Storage type | A DRAM-based instance that is compatible with Redis 6.0 |
Engine version | 6.2.1.1 |
Instance architecture | The standard master-replica architecture that does not have the cluster mode enabled. For more information, see Standard architecture. |
Instance type | The test results are less susceptible to instance types. In this example, the tair.rdb.4g instance type is used. For more information, see DRAM-based instances. |
Client
Environment-related item | Description |
---|---|
Host of the client | An Elastic Compute Service (ECS) instance of the ecs.g5ne.16xlarge instance type is used. 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 virtual private cloud (VPC) where the Tair and ECS instances reside |
Test tool
Method
Connect to the ECS instance, download and compile the Redis source code, and then generate a redis-benchmark file to start your test.
./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 Tair instance. For more information, see View endpoints and port numbers. |
-p | The service port number that is used to connect to the Tair instance. Default value: 6379. |
-a | The password of the account that is used to connect to the Tair instance. Note If you are using an account that is created in the Tair console to connect to the instance, the password must be in the <user>:<password> format. For example, if the username of the account is admin and the password is Rp829dlwa, use admin:Rp829dlwa as the password to connect to the Tair instance. |
-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 command used in testing, such as GET or SET. |
-d | The value that you process by using a SET or GET command. Unit: bytes. |
-r | The random range of the used keys. It specifies the number of keys to be used. |
--threads | Runs a multi-threaded stress test and specifies the number of threads. |
Test results
This section provides the test results of basic ApsaraDB for Redis commands like SET and GET in different scenarios.
Test metrics
Test metric | Description |
---|---|
QPS | The number of read and write operations that are processed per second. |
Latency | The average latency for a specified proportion of operations. Unit: milliseconds. |
99th Percentile Latency | The maximum latency for the fastest 99% of all requests. Unit milliseconds. For example, a value of 0.5 indicates that 99% of requests can be processed within 0.5 milliseconds. |
Strings
- GETSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t get
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 523907.66 0.476 0.719 128 519363.59 0.476 0.871 256 517027.44 0.480 0.839 1024 487709.72 0.509 0.879 4096 385728.06 0.629 1.319 Note- Read requests are not affected by master-replica synchronization or data persistence. As a result, the CPU utilization is high.
- In this test, append-only file (AOF) persistence is enabled for the Tair instance. If you disable this feature, the queries per second (QPS) can be improved by about 10%.
- SETSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t set
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 260642.91 0.956 1.871 128 244758.09 1.035 2.015 256 235128.14 1.072 2.119 1024 173761.95 1.462 2.783 4096 66198.86 3.857 66.687 Note In this test, a standard Tair instance is used. The default maximum bandwidth is 96 MB/s. The throttling mechanism provided by Tair is triggered when the upper bandwidth limit is reached at a value length of 480 bytes and QPS of up to 200,000. QPS decrease in inverse proportion to the value length. If you have higher requirements for bandwidth, we recommend that you choose cluster or read/write splitting instances. - MSETSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t mset
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 66533.60 3.637 9.735 128 66533.60 3.756 12.679 256 70439.07 3.610 14.487 1024 38634.90 6.497 97.407 - INCRSample command that involves 16 threads, 256 connections, and 3,000,000 keys:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -t incr
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) None 244758.09 1.024 2.879
Lists
- LPUSHSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t lpush
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 133220.84 1.911 3.943 128 137797.98 1.846 3.831 256 130332.78 1.956 4.087 1024 116400.88 2.183 4.439 4096 68101.34 3.732 8.727 - LPOPSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t lpop
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 122354.09 2.084 4.343 128 122324.16 2.085 4.359 256 113079.53 2.239 4.719 1024 74447.23 3.419 7.007 4096 74449.07 3.410 7.071 - RPUSHSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t rpush
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 119875.34 2.129 4.583 128 116391.85 2.187 4.631 256 105148.78 2.409 5.095 1024 82674.24 3.073 6.023 4096 69683.18 3.656 6.271 - RPOPSample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t rpop
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) 16 110996.01 2.281 4.919 128 101584.73 2.500 5.287 256 92205.56 2.764 5.783 1024 76324.23 3.339 6.759 4096 79377.68 3.207 6.267
Sets
- SADDSample command that involves 16 threads, 256 connections, and 3,000,000 keys:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -t sadd
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) None 111020.66 2.286 4.927 - SPOPSample command that involves 16 threads, 256 connections, and 3,000,000 keys:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -t spop
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) None 67315.89 3.784 7.847
Sorted sets
- ZADDSample command that involves 16 threads, 256 connections, and 3,000,000 keys:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -t zadd
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) None 53490.24 4.761 9.799 - ZPOPMINSample command that involves 16 threads, 256 connections, and 3,000,000 keys:
Test results:./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -t zpopmin
Value length (bytes) QPS Average latency (milliseconds) 99th percentile latency (milliseconds) None 114163.94 2.227 4.871
Hashes
HSET
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -n 3000000 -r 30000000 -c 256 --threads 16 -d 16 -t hset
Test results:Value length (bytes) | QPS | Average latency (milliseconds) | 99th percentile latency (milliseconds) |
---|---|---|---|
16 | 108964.12 | 2.327 | 5.103 |
128 | 111012.43 | 2.293 | 5.039 |
256 | 108960.16 | 2.336 | 5.103 |
1024 | 103334.25 | 2.466 | 5.143 |
4096 | 61469.11 | 4.147 | 7.263 |
Summary
Tair DRAM-based instances use an in-house multi-thread model that delivers higher QPS at lower latency. In this context, Redis 6.0-compatible Tair DRAM-based instances demonstrate good performance in various scenarios.