Updated on 2023-11-27 GMT+08:00

Using memtier_benchmark

This section describes how to use memtier_benchmark to test the performance of DCS Redis instances. For example, you can test how fast a specific instance responds to high-concurrency SET or GET operations.

Test Tool

memtier_benchmark is a command-line tool developed by Redis Labs. It can generate traffic in various modes and supports both Redis and Memcached.

This tool provides multiple options and reporting features that can be easily used through the CLI.

For details, visit https://github.com/RedisLabs/memtier_benchmark.

Downloading and Installing the Tool

CentOS 8.0 is used as an example.

  1. Preparations
    1. Install the tools required for compilation.

      yum install -y autoconf

      yum install -y automake

      yum install -y make

      yum install -y gcc-c++

      yum install -y git

    2. Enable the PowerTools repository.

      dnf config-manager --set-enabled PowerTools

    3. Install the required dependencies.

      yum install -y pcre-devel

      yum install -y zlib-devel

      yum install -y libmemcached-devel

      yum install -y openssl-devel

  2. Install the libevent library.

    yum install -y libevent-devel

  3. Download, compile, and install the memtier_benchmark library.
    1. Create a folder in the root directory where the memtier_benchmark library will be stored.

      mkdir /env

    2. Download the memtier_benchmark source code.

      cd /env

      git clone https://github.com/RedisLabs/memtier_benchmark.git

    3. Go to the directory where the source code is located.

      cd memtier_benchmark

    4. Compile the source code and generate the executable file memtier_benchmark.

      autoreconf -ivf

      ./configure

      make

    5. Install the tool in the system.

      make install

  4. Run the following command to check whether the installation is successful:

    memtier_benchmark --help

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 memtier_benchmark on each ECS by referring to Downloading and Installing the Tool.
  4. Run the following test command on all ECSs:

    memtier_benchmark -s {IP} -n {nreqs}  -c {connect_number}  -t 4 -d {datasize}

    Run memtier_benchmark --cluster-mode -s {IP} -n {nreqs} -c {connect_number} -t 4 -d {datasize} for a Redis Cluster instance.

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

    • -t indicates the number of threads used in the benchmark test.
    • -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.

Test Metric

Queries per second (QPS), which is the number of commands processed per second.