All Products
Document Center

How to use memtier_benchmark to test the performance of ApsaraDB for Redis Cluster Version

Last Updated: Nov 19, 2019


This topic describes how to use memtier_benchmark to test the performance of ApsaraDB for Redis Cluster Version.



Memtier-benchmark overview

The memtier_benchmark tool can be used to generate data for a variety of structures, perform stress testing on databases, and help you understand database performance limits. The tool allows you to:

  • Test Redis and Memcached databases.
  • Perform multi-thread and multi-client tests.
  • Set the SET:GET ratio in the test.
  • Customize the structures of keys to be tested.
  • Set random expiration time.



You have installed the following libraries or tools in your Linux operating system:

  • Git
  • libevent 2.0.10 or later
  • PCRE library 8.x
  • Autoconf
  • Automake
  • GNU make
  • GCC-C++ compiler

If any of these components have not been installed, perform the following steps to install them.

Note: In this topic, the components are installed in CentOS 7.2 of an Alibaba Cloud ECS instance.

  1. Run the following command to install Git:
    yum install git
  2. Run the following command to install the compiler:
    yum install autoconf automake make gcc-c++
  3. Run the following command to install the libraries.
    yum install pcre-devel zlib-devel libmemcached-devel
  4. If your operating system does not contain the required libevent, run the following commands to download and install libevent-2.0.21:
    tar xfz libevent-2.0.21-stable.tar.gz
    pushd libevent-2.0.21-stable
    sudo make install
  5. Set PKG_CONFIG_PATH to enable the configure script to locate the libraries installed in the preceding steps.
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}


Download and install memtier_benchmark

  1. Clone the source file of memtier_benchmark to a local directory using Git.
    git clone
    cd memtier_benchmark
  2. Compile and install memtier_benchmark.
    autoreconf -ivf
    make install


Test procedure

A test command example and common parameters are described as follows. For more information, see ApsaraDB for Redis Performance White Paper.

./memtier_benchmark -s -p 6379 -a XXX -c 20 -d 32 --threads=10 --ratio=1:1 --test-time=1800 --select-db=10
Parameter Description
-s The endpoint of the ApsaraDB for Redis database.
-a The password for the ApsaraDB for Redis database.
-c The number of clients connected to the ApsaraDB for Redis database in the test.
-d The size of the object data used in the test.
--threads The number of threads used in the test.
--ratio The SET:GET ratio of commands in the test.
--test-time The duration of the test. Unit: seconds.
--select-db The number of databases used in the test.


  • For more information about memtier_benchmark, run the memtier_benchmark -help command.
  • The test results on a single host may not reflect the performance limits of ApsaraDB for Redis due to restrictions of the test host such as the Linux host for the ECS instance in this topic. For more information, see Test environment.


Application scope

  • ApsaraDB for Redis