Updated on 2022-09-15 GMT+08:00

Using redis-benchmark

This section describes how to use redis-benchmark to test the performance of Distributed Cache Service (DCS) Redis instances. For example, you can test how fast a specific instance responds to high-concurrency SET or GET operations.

Test Tool

The Redis client includes redis-benchmark, a performance testing utility that simulates N clients concurrently sending M number of query requests.

For details about how to use the redis-benchmark tool, see Overview of redis-cli and redis-benchmark.

Downloading and Installing the Tool

  1. Download the redis-6.0.9 client.

    wget http://download.redis.io/releases/redis-6.0.9.tar.gz

  2. Decompress the client installation package.

    tar xzf redis-6.0.9.tar.gz

  3. Go to the src directory of redis-6.0.9.

    cd redis-6.0.9/src

  4. Compile the source code.

    make

  5. Check whether the redis-benchmark executable file exists.

    ls

  6. Install the tool in the system.

    make install

Test Procedure

  1. Create a DCS Redis instance.
  2. Create three ECSs and configure the same AZ, VPC, subnet, and security group for the ECSs and the instance.

    Only one ECS is required for testing on a single-node or master/standby instance.

  3. Install redis-benchmark on each ECS by referring to Downloading and Installing the Tool.
  4. Run the following test command on all ECSs:

    redis-benchmark -h {IP} -p {Port} -a {password} -n {nreqs} -r {randomkeys} -c {connect_number} -d {datasize} -t {command}

    Reference values: -c {connect_number}: 200; -n {nreqs}: 10,000,000; -r {randomkeys}: 1,000,000; -d {datasize}: 32

    • -t indicates the set of commands to be executed. For example, to test only the set command, use -t set. To test the ping, get, and set commands, use -t ping,set,get. Use commas (,) to separate commands.
    • -c indicates the number of client connections.
    • -d indicates the size of a single data record in bytes.
    • -n indicates the number of test packets.
    • -r indicates the number of random keys.

  5. Repeat 4 with different client connections to obtain the maximum number of operations per second.
  6. The sum of operations per second of all the three ECSs indicates the performance of the instance specification.

    To test on a Redis Cluster instance, launch two benchmark tools on each ECS.

    • Add the --cluster parameter only when testing Redis Cluster instances using redis-benchmark.
    • In a test for the maximum number of connections of a Redis Cluster instance, if the performance of the ECSs is insufficient, the program will exit or the error message "Cannot assign requested address" will be displayed when the number of connections reaches 10,000. In this case, check how many ECSs are used in the test. Prepare three ECSs and start three redis-benchmark processes on each ECS.