Benchmarking Redis Performance: Tools and Techniques

Redis is an open-source, in-memory data structure store, often used as a database, cache, or message broker. It offers high-performance data storage and retrieval capabilities, which makes it suitable for use cases requiring low-latency and high throughput. As with any software, it's essential to benchmark Redis performance to ensure it meets your application's requirements and optimizes system resources. This blog post will cover various tools and techniques to help you benchmark Redis performance effectively. We'll discuss different benchmarking tools, provide code examples, and explain how to interpret the results.

Understanding Redis Performance Metrics

Before diving into benchmarking tools and techniques, it's crucial to understand the key performance metrics used to evaluate Redis performance. Some of the essential Redis performance metrics include:

  1. Throughput: The number of requests processed per second by the Redis server.
  2. Latency: The time it takes for a client to send a request and receive a response from the Redis server.
  3. Memory Usage: The amount of memory consumed by Redis to store data and manage internal structures.

Redis Benchmark Tool: redis-benchmark

redis-benchmark is a command-line tool provided by Redis to quickly generate workloads and measure performance. It's included with the Redis distribution and is an excellent starting point for benchmarking.

Installing redis-benchmark

To install redis-benchmark, simply install Redis on your system. The benchmark tool is included in the Redis package. You can find installation instructions for your platform in the official Redis documentation.

Using redis-benchmark

To run redis-benchmark, open a terminal and type the following command:

redis-benchmark [OPTIONS]

The tool offers various options to control the benchmarking process. Some of the common options include:

  • -h: Redis server hostname (default is
  • -p: Redis server port (default is 6379)
  • -c: Number of parallel connections (default is 50)
  • -n: Total number of requests (default is 100000)
  • -t: Comma-separated list of tests to run (default is all tests)
  • -d: Data size for SET/GET values in bytes (default is 3)

For example, to run a benchmark with 100 parallel connections, 1 million requests, and 64-byte payloads, execute the following command:

redis-benchmark -c 100 -n 1000000 -d 64

Interpreting redis-benchmark Results

The redis-benchmark tool provides output in the following format:

====== <TEST_NAME> ======
  <NUM_REQUESTS> requests completed in <SECONDS> seconds
  <NUM_CONNECTIONS> parallel clients
  <PAYLOAD_SIZE> bytes payload
  <THROUGHPUT> requests per second
  <LATENCY> ms per request (avg)
  <LATENCY_99TH> ms per request (99th percentile)

Using this output, you can evaluate Redis performance by examining the throughput, average latency, and 99th percentile latency.

Advanced Benchmarking with Memtier

While redis-benchmark is a simple and effective tool for evaluating Redis performance, it lacks some advanced features required for more extensive testing. Memtier_benchmark is an alternative tool that provides more advanced benchmarking capabilities.

Installing memtier_benchmark

You can install memtier_benchmark from its GitHub repository. Follow the installation instructions provided in the README file for your platform.

Using memtier_benchmark

To run memtier_benchmark, open a terminal and typethe following command:

memtier_benchmark [OPTIONS]

memtier_benchmark offers numerous options to control the benchmarking process. Some of the common options include:

  • --server: Redis server hostname (default is
  • --port: Redis server port (default is 6379)
  • --protocol: Protocol to use (redis or memcache, default is redis)
  • --clients: Number of parallel connections (default is 1)
  • --requests: Total number of requests per client (default is 10000)
  • --test-time: Test duration in seconds (overrides –requests)
  • --ratio: SET:GET command ratio (default is 1:10)
  • --data-size: Data size for SET/GET values in bytes (default is 32)
  • --pipeline: Number of commands to pipeline (default is 1)
  • --key-pattern: Key pattern to use (default is R:R, random keys for both SET and GET)

For example, to run a benchmark with 50 parallel connections, a 1:1 SET:GET ratio, and 128-byte payloads, execute the following command:

memtier_benchmark --clients 50 --ratio 1:1 --data-size 128

Interpreting memtier_benchmark Results

memtier_benchmark provides output in the following format:

<NUM_CONNECTIONS> Threads:        <NUM_REQUESTS> Ops,       <THROUGHPUT> ops/sec,      <LATENCY> msec avg

Using this output, you can evaluate Redis performance by examining the throughput and average latency.

Monitoring Redis Performance in Real-time

While benchmarking tools help evaluate Redis performance under various conditions, it's also essential to monitor Redis performance in real-time during application operation. Redis provides the redis-cli tool, which includes a monitor command to observe Redis commands in real-time.

Using redis-cli monitor

To run redis-cli monitor, open a terminal and type the following command:

redis-cli monitor

This command will display all the Redis commands processed by the server in real-time. To filter specific commands or keys, you can use tools like grep:

redis-cli monitor | grep "GET"

This command will display only the GET commands processed by the Redis server.


Q: How can I improve Redis performance?

A: Some general tips for improving Redis performance include:

  1. Use pipelining to send multiple commands at once and reduce network latency.
  2. Optimize data structures and use Redis-specific data structures like hashes or lists where applicable.
  3. Configure Redis persistence and eviction policies to match your use case.
  4. Use appropriate hardware, such as SSDs and sufficient memory, to handle the workload.

Q: How do I measure the memory usage of my Redis instance?

A: You can use the redis-cli tool and the info command to get memory usage information. Run redis-cli info memory, and look for the used_memory field in the output.

Q: Can I run multiple instances of Redis on the same server?

A: Yes, you can run multiple Redis instances on the same server by configuring each instance to listen on a different port or IP address.

Q: How can I simulate different workloads for benchmarking Redis?

A: Both redis-benchmark and memtier_benchmark offer options to configure the test workload. You can adjust the number of parallel connections, request count, data size, command ratio, and more to simulate different workloads.

Sharing is caring

Did you like what Mehul Mohan wrote? Thank them for their work by sharing it on social media.


No comments so far