This topic describes how to use memtier_benchmark to test the performance of ApsaraDB for Redis Cluster Version.
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:
- libevent 2.0.10 or later
- PCRE library 8.x
- 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.
- Run the following command to install Git:
yum install git
- Run the following command to install the compiler:
yum install autoconf automake make gcc-c++
- Run the following command to install the libraries.
yum install pcre-devel zlib-devel libmemcached-devel
- If your operating system does not contain the required libevent, run the following commands to download and install libevent-2.0.21:
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar xfz libevent-2.0.21-stable.tar.gz pushd libevent-2.0.21-stable ./configure make sudo make install popd
- Set PKG_CONFIG_PATH to enable the configure script to locate the libraries installed in the preceding steps.
Download and install memtier_benchmark
- Clone the source file of memtier_benchmark to a local directory using Git.
git clone https://github.com/RedisLabs/memtier_benchmark.git cd memtier_benchmark
- Compile and install memtier_benchmark.
autoreconf -ivf ./configure make make install
A test command example and common parameters are described as follows. For more information, see ApsaraDB for Redis Performance White Paper.
./memtier_benchmark -s r-XXXX.redis.rds.aliyuncs.com -p 6379 -a XXX -c 20 -d 32 --threads=10 --ratio=1:1 --test-time=1800 --select-db=10
|-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
- 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.
- ApsaraDB for Redis