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
- Create a DCS Redis instance.
- Create three ECSs. Only one ECS is required for testing on a single-node or master/standby instance. Configure the same AZ, VPC, subnet, and security group for the ECSs and the instance.
- Install memtier_benchmark on each ECS.
This step uses CentOS 8.0 as an example. To install memtier_benchmark in Ubuntu, see Installing memtier_benchmark on Ubuntu.
- Preparations
- Download, compile, and install the memtier_benchmark library.
- Create a folder in the root directory where the memtier_benchmark library will be stored.
- Download the memtier_benchmark source code.
git clone https://github.com/RedisLabs/memtier_benchmark.git
If the following error information is displayed during the download of the memtier_benchmark source code, run the git clone https://github.com/RedisLabs/memtier_benchmark.git -b 1.4.0 command to install another branch.

- Go to the directory where the source code is located.
- Compile the source code and generate the executable file memtier_benchmark.
autoreconf -ivf
./configure
make
- Install the tool in the system.
- Run the following command to check whether the installation is successful: If a parameter description of memtier_benchmark is returned, the installation is successful.
- Run the following test command on all ECSs:
For single-node, master/standby, Proxy Cluster, and read/write splitting instances:
memtier_benchmark -s {IP} -p {port} -n {nreqs} -c {connect_number} -t 4 -d {datasize} -a {password}For Redis Cluster instances:
memtier_benchmark --cluster-mode -s {IP} -p {port} -n {nreqs} -c {connect_number} -t 4 -d {datasize} -a {password}Reference values: -c {connect_number}: 200; -n {nreqs}: 10000000; -d {datasize}: 32
- -s indicates the domain name or IP address of the instance.
- -p: port of the instance. The default value is 6379.
- -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.
- -a: password for connecting to the instance. This parameter is not required for password-free instances.
- Repeat 4 with different client connections to obtain the maximum QPS (Query per Second, number of read and write operations per second).
- 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.
Common memtier_benchmark Options
- -s <server> indicates the domain name or IP address of the instance.
- -p <port>: port of the instance. The default value is 6379.
- -t <threads> indicates the number of threads used in the benchmark test. For example, -t 4 indicates that four threads are used.
- -c <clients>: specifies the number of concurrent clients. For example, -c 50 indicates that 50 clients are connected concurrently.
- -d <bytes> indicates the size of a single data record in bytes.
- -n <requests>: specifies the number of requests sent by each client.
- -a <password>: password for connecting to the instance. This parameter is not required for password-free instances.
- --ratio <ratio>: specifies the SET:GET operation ratio. For example, --ratio=1:0 indicates that the write-to-read ratio is 1:0.
- --test-time <seconds>: specifies the test duration, in seconds. This option cannot be used with -n.
- --key-prefix <prefix>: specifies the prefix of the pressure test key.
- --key-minimum <min>: specifies the minimum value of the key. The default value is 0.
- --key-maximum <max_key>: specifies the maximum value of the key. The default value is 10000000.
- --key-pattern <pattern>: specifies the key generation pattern. The default value is R:R, indicating that the key is randomly generated.
For details, visit https://github.com/RedisLabs/memtier_benchmark.
Installing memtier_benchmark on Ubuntu
You can install memtier_benchmark on Ubuntu in either of the following ways:
- By package
sudo apt install lsb-release curl gpg curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list sudo apt-get update sudo apt-get install memtier-benchmark
- By compiling the source code. The following commands are used to install v2.2.0. To obtain the latest version, see Releases.
sudo apt-get install build-essential autoconf automake \ libevent-dev pkg-config zlib1g-dev libssl-dev cd /tmp && git clone https://github.com/RedisLabs/memtier_benchmark.git -b 2.2.0 cd memtier_benchmark autoreconf -ivf && ./configure && make sudo make install
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot