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 itemDescription
Region and zoneZone A in the China (Zhangjiakou) region
Storage typeA DRAM-based instance that is compatible with Redis 6.0
Engine version6.2.1.1
Instance architectureThe standard master-replica architecture that does not have the cluster mode enabled. For more information, see Standard architecture.
Instance typeThe 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 itemDescription
Host of the clientAn Elastic Compute Service (ECS) instance of the ecs.g5ne.16xlarge instance type is used. For more information, see Overview of instance families.
Region and zoneZone A in the China (Zhangjiakou) region
Operating systemCentOS 7.2 64-bit
NetworkThe virtual private cloud (VPC) where the Tair and ECS instances reside

Test tool

The redis-benchmark tool is used. It is the official test tool of open source Redis that can be used to benchmark Tair performance. In this example, redis-benchmark 7.0.6 is used.
Note To ensure that the --threads parameter is available, we recommend that you use the latest version of redis-benchmark. For more information, visit GitHub.

Method

Connect to the ECS instance, download and compile the Redis source code, and then generate a redis-benchmark file to start your test.

To test the SET command performance, you can run the following command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 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
Table 1. Parameters
ParameterDescription
-hThe internal endpoint of the Tair instance. For more information, see View endpoints and port numbers.
-pThe service port number that is used to connect to the Tair instance. Default value: 6379.
-aThe 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.
-cThe number of concurrent connections.
-nThe total number of requests tested. Set this parameter to a large value to ensure continuous stress testing.
-tThe command used in testing, such as GET or SET.
-dThe value that you process by using a SET or GET command. Unit: bytes.
-rThe random range of the used keys. It specifies the number of keys to be used.
--threadsRuns a multi-threaded stress test and specifies the number of threads.
Note For more information about the parameters, see Redis benchmark.

Test results

This section provides the test results of basic ApsaraDB for Redis commands like SET and GET in different scenarios.

Test metrics

Test metricDescription
QPSThe number of read and write operations that are processed per second.
LatencyThe average latency for a specified proportion of operations. Unit: milliseconds.
99th Percentile LatencyThe 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

  • GET
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16523907.660.4760.719
    128519363.590.4760.871
    256517027.440.4800.839
    1024487709.720.5090.879
    4096385728.060.6291.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%.
  • SET
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16260642.910.9561.871
    128244758.091.0352.015
    256235128.141.0722.119
    1024173761.951.4622.783
    409666198.863.85766.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.
  • MSET
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    1666533.603.6379.735
    12866533.603.75612.679
    25670439.073.61014.487
    102438634.906.49797.407
  • INCR
    Sample command that involves 16 threads, 256 connections, and 3,000,000 keys:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    None244758.091.0242.879

Lists

  • LPUSH
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16133220.841.9113.943
    128137797.981.8463.831
    256130332.781.9564.087
    1024116400.882.1834.439
    409668101.343.7328.727
  • LPOP
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16122354.092.0844.343
    128122324.162.0854.359
    256113079.532.2394.719
    102474447.233.4197.007
    409674449.073.4107.071
  • RPUSH
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16119875.342.1294.583
    128116391.852.1874.631
    256105148.782.4095.095
    102482674.243.0736.023
    409669683.183.6566.271
  • RPOP
    Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    16110996.012.2814.919
    128101584.732.5005.287
    25692205.562.7645.783
    102476324.233.3396.759
    409679377.683.2076.267

Sets

  • SADD
    Sample command that involves 16 threads, 256 connections, and 3,000,000 keys:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    None111020.662.2864.927
  • SPOP
    Sample command that involves 16 threads, 256 connections, and 3,000,000 keys:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    None67315.893.7847.847

Sorted sets

  • ZADD
    Sample command that involves 16 threads, 256 connections, and 3,000,000 keys:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    None53490.244.7619.799
  • ZPOPMIN
    Sample command that involves 16 threads, 256 connections, and 3,000,000 keys:
    ./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
    Test results:
    Value length (bytes)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
    None114163.942.2274.871

Hashes

HSET

Sample command that involves 16 threads, 256 connections, 3,000,000 keys, and a maximum value length of 16 bytes:
./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)QPSAverage latency (milliseconds)99th percentile latency (milliseconds)
16108964.122.3275.103
128111012.432.2935.039
256108960.162.3365.103
1024103334.252.4665.143
409661469.114.1477.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.