How to Check Redis Object Cache Performance Using “redis-benchmark”

On this page
  1. Why Test Redis Performance?
  2. What Is redis-benchmark?
  3. Basic Usage of redis-benchmark
  4. Testing Specific Operations
  5. Adjusting Test Parameters
  6. Specify the Number of Requests
  7. Adjust Concurrent Connections
  8. Combine Multiple Parameters
  9. Understanding the Results
  10. Requests Per Second
  11. Latency
  12. Percentiles
  13. Best Practices for Accurate Testing
  14. Test During Low-Traffic Periods
  15. Compare Before and After Changes
  16. Monitor System Resources
  17. Use Realistic Workloads
  18. Summary

Redis is a high-performance in-memory database commonly used as an object cache for applications such as WordPress, Magento, Laravel, and other dynamic websites. When Redis is configured as an object cache, it helps reduce database load and improve application response times by storing frequently requested data in memory.

To ensure Redis is operating efficiently, you can use the redis-benchmark utility to measure its performance and evaluate how well it handles requests under load.

Why Test Redis Performance?

Performance testing helps you verify that Redis is capable of handling your application’s workload.

Benefits of testing include:

  • Identifying performance bottlenecks
  • Measuring server response times
  • Verifying Redis configuration changes
  • Comparing performance before and after upgrades
  • Evaluating server capacity under load

Regular testing is particularly useful on busy websites where Redis plays a critical role in reducing database queries and improving page load times.

What Is redis-benchmark?

redis-benchmark is a command-line utility included with Redis installations. It generates a configurable number of requests and measures how quickly Redis can process them.

The tool can simulate various Redis commands, including:

  • GET
  • SET
  • INCR
  • LPUSH
  • LRANGE
  • PING

The results help determine the number of operations Redis can process per second and the average response time.

Basic Usage of redis-benchmark

To perform a standard benchmark against the local Redis instance, run:

redis-benchmark

This command executes a series of tests using Redis default settings and displays performance statistics for common operations.

Testing Specific Operations

You can limit testing to specific Redis commands using the -t parameter.

For example, to test only SET operations:

redis-benchmark -t set

To test only GET operations:

redis-benchmark -t get

To test multiple operations:

redis-benchmark -t get,set

This approach is useful when evaluating workloads that closely match your application’s behavior.

Adjusting Test Parameters

Specify the Number of Requests

By default, redis-benchmark performs 100,000 requests.

To increase the number of operations:

redis-benchmark -n 1000000

This command performs one million requests.

Adjust Concurrent Connections

To simulate multiple clients connecting simultaneously:

redis-benchmark -c 100

This example uses 100 concurrent connections.

Combine Multiple Parameters

For example:

redis-benchmark -t get,set -n 500000 -c 50

This command performs 500,000 GET and SET operations using 50 concurrent clients.

Understanding the Results

After the benchmark completes, Redis displays information similar to:

SET: 120000 requests per second
GET: 150000 requests per second

Key metrics include:

Requests Per Second

Indicates how many operations Redis can process each second.

Higher values generally indicate better performance.

Latency

Latency measures the time required to complete a request.

Lower latency values are preferable because they indicate faster responses.

Percentiles

Some benchmark results include percentile information, showing how quickly most requests are completed.

For example:

95% <= 1 ms

This means that 95% of requests completed within 1 millisecond.

Best Practices for Accurate Testing

Test During Low-Traffic Periods

Running benchmarks on a busy production server may affect users and produce inconsistent results.

Compare Before and After Changes

Run benchmarks before and after:

  • Redis upgrades
  • Server migrations
  • Configuration changes
  • Hardware upgrades

This helps verify whether performance improved.

Monitor System Resources

While testing, monitor:

  • CPU usage
  • Memory consumption
  • Disk activity
  • Network utilization

Tools such as htop, top, and vmstat can help identify system bottlenecks.

Use Realistic Workloads

Configure the benchmark to resemble your application’s actual usage patterns whenever possible.

Summary

The redis-benchmark utility provides a simple and effective way to measure Redis performance and validate that your object cache is operating efficiently.

A typical benchmarking workflow includes:

  • Running a baseline benchmark
  • Testing specific Redis operations
  • Simulating realistic concurrency levels
  • Monitoring server resources during testing
  • Comparing results after configuration or infrastructure changes

Regular Redis performance testing helps ensure your caching layer continues to deliver fast response times and optimal application performance.

Didn't find an answer?

Our support team is here for you 24/7 – write to us and we will help you sort it out.