Help Center/ Distributed Cache Service/ User Guide/ Testing Instance Performance/ Testing Redis Performance Using memtier_benchmark
Updated on 2024-10-17 GMT+08:00

Testing Redis Performance Using memtier_benchmark

memtier_benchmark is a command-line tool developed by Redis Labs. It can generate traffic in various modes and supports Redis. 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.

This section describes how to use memtier-benchmark to test the performance of a DCS Redis instance when running command SET or GET in a high-concurrency scenario.

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. 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: If a parameter description of memtier_benchmark is returned, the installation is successful.

      memtier_benchmark --help

  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; -d {datasize}: 32

    • -s indicates the domain name or IP address of the instance.
    • -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.

  5. Repeat 4 with different client connections to obtain the maximum QPS (Query per Second, number of read and write 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.