Module A-14·20 min read

redis-benchmark usage and interpreting results, OS-level tuning (transparent huge pages, TCP backlog, ulimit), slowlog analysis, latency percentile monitoring, and the 5 configuration changes that meaningfully improve throughput.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

A-14 — Performance Benchmarking and Production Tuning

Who this module is for: Redis is slower than expected — commands are taking longer than they should, throughput is lower than the hardware should support, or latency spikes are occurring under load. This module covers redis-benchmark for baseline measurement, OS-level tuning that meaningfully impacts Redis performance, and the configuration changes that consistently improve throughput in production.


redis-benchmark: Establishing Baselines

redis-benchmark is the official Redis performance testing tool. Always benchmark before tuning — you need a baseline to know whether a change improved anything.

bash

Interpreting Results

text

What these numbers mean:

  • 117K ops/sec for SET with 50 clients and 3-byte payload is typical for a local Redis
  • With 1KB payload: expect 50–80K ops/sec (memory bandwidth becomes the bottleneck)
  • With 100KB payload: expect 5–10K ops/sec (dominated by serialisation and network bandwidth)

What redis-benchmark does not test:

  • Your actual command mix (most workloads are not 100% GET or 100% SET)
  • Real client libraries (ioredis has overhead compared to the raw C client benchmark uses)
  • Production network topology (benchmark runs locally by default)

Always supplement with production metrics from INFO commandstats to understand your real-world baseline.


OS-Level Tuning

Redis performance is heavily influenced by OS configuration. These are the settings that matter most.

1. Disable Transparent Huge Pages (THP)

THP causes Redis latency spikes during BGSAVE because copy-on-write must duplicate 2MB pages instead of 4KB pages. Redis explicitly warns you if THP is enabled:

text

Disable permanently:

bash

Impact: Eliminates latency spikes of 10–100ms that occur during BGSAVE on write-heavy instances.

2. Increase System File Descriptor Limit

Each Redis client connection uses a file descriptor. The default limit (1024 on many Linux systems) is too low for production Redis:

bash

Also configure in redis.conf:

maxclients 10000 → Redis will set the OS fd limit accordingly

3. TCP Backlog

The TCP backlog queue holds pending connection requests. Under high connection rates, a small backlog causes connections to be silently dropped:

bash

Redis also warns when the OS TCP backlog is smaller than its configured backlog:

WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
text

4. Disable Swap (or Configure Swappiness)

Redis accesses data randomly across its entire working set. If any Redis data is swapped to disk, access times jump from microseconds to milliseconds.

bash

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.