WordPress Redis Object Cache Slow Under Load? How to Speed It Up

Murtaza Shajapurwala ·

On a quiet WordPress site, the Redis object cache is the thing that makes pages fast. On a busy one, it can become the thing that slows them down. Traffic climbs, time-to-first-byte climbs with it, and top on the cache server shows redis-server pinned at 100% of one CPU core while the other cores sit idle.

This post explains why the object cache hits a ceiling under load, what to tune in WordPress and Redis first, and how a multi-threaded, Redis-compatible server raises the ceiling. We measured it on a WordPress-shaped cache.

Why does the Redis object cache get slow under traffic?

A WordPress page doesn't make one cache call. With a persistent object cache (the Redis Object Cache plugin, Object Cache Pro, or a host's built-in one), every get_option(), get_post_meta(), term lookup and transient becomes a Redis GET, and every miss a SET. A typical page makes dozens to hundreds of them.

Multiply that by your PHP workers. Twenty PHP-FPM workers rendering pages at the same time can mean thousands of cache commands in flight. Redis executes commands on a single thread, so however many cores the machine has, every one of those commands queues for the same core. Once that core is saturated, each extra request waits in line, and the wait shows up directly in page time.

How to tell if Redis is your bottleneck

  • CPU: redis-server at or near 100% of one core during peak traffic (top, or your host's metrics), while PHP isn't saturated.
  • Latency: redis-cli --latency from the web server rises under load, from a fraction of a millisecond toward several.
  • Volume: redis-cli INFO stats shows instantaneous_ops_per_sec in the tens of thousands or more at peak.
  • The plugin's own metrics: the Redis Object Cache plugin's dashboard shows the time spent in Redis per request climbing with traffic.

If page time rises with traffic while Redis's one core is pinned, the object cache is the ceiling.

How to speed up the WordPress object cache

Start with the free wins:

  1. Use persistent connections: define( 'WP_REDIS_PERSISTENT', true ); saves a connection setup on every PHP request.
  2. Use a Unix socket when Redis runs on the same server: WP_REDIS_SCHEME set to unix and WP_REDIS_PATH pointing at the socket. That skips the TCP stack.
  3. Serialize with igbinary (needs the PHP extension): define( 'WP_REDIS_IGBINARY', true );. Smaller values mean less memory and less to copy per call.
  4. Trim autoloaded options. alloptions is fetched on every request. A bloated one, with plugins autoloading megabytes, makes every page heavier.
  5. Don't cache what churns. WP_REDIS_IGNORED_GROUPS keeps groups that change on every request out of Redis.
  6. Bound memory with a TTL: WP_REDIS_MAXTTL caps how long keys live, so stale query caches don't pile up.
  7. Turn on Redis I/O threads (io-threads in Redis 6 and later). They take network reads and writes off the main thread, but commands still run on that one thread.

If you've done all of that and Redis's single core is still the ceiling, the remaining option is a server that runs commands on more than one core.

A multi-threaded, Redis-compatible object cache: what we measured

KiviDB is a Redis-compatible server that executes commands across all available cores. We loaded a cache shaped like a WordPress object cache: 1 million keys with WordPress-style names (posts, post_meta, options, terms, query caches, transients) and serialized-PHP values from 100 bytes to 8 KB. Then we drove it with 100 concurrent clients, the load a busy site's PHP workers generate. Redis 8.10, Valkey 8.1 and KiviDB 1.2.2 each ran on default settings on the same 8-vCPU machine, one at a time.

A WordPress object cache under load with 100 concurrent clients: Redis 8.10 114k GETs/s at 0.86 ms median, Valkey 8.1 111k/s at 0.87 ms, KiviDB 1.2.2 200k/s at 0.29 ms.

100 concurrent clientsRedis 8.10Valkey 8.1KiviDB 1.2.2
GET, 2 KB values114k/s, median 0.86 ms111k/s, median 0.87 ms200k/s, median 0.29 ms
GET, 512 B values143k/s, median 0.69 ms143k/s, median 0.67 ms200k/s, median 0.34 ms
SET, 2 KB values125k/s, median 0.77 ms118k/s, median 0.78 ms181k/s, median 0.30 ms
Memory for the 1M-key cache1.43 GiB1.43 GiB1.32 GiB

Under load, KiviDB served 1.4–1.75× as many cache calls at a third to a half of the median latency. On a page that makes 200 cache calls, half a millisecond saved per call adds up. It also stored the same cache with 60% less overhead per key: 67 MiB above the raw data, against about 170 MiB for Redis and Valkey.

The gain shows up under concurrency. On a quiet site, a single cache call is dominated by network round-trip time, and any Redis-compatible server will feel the same. The difference appears when many PHP workers hit the cache at once, which is exactly when a single-threaded server starts queueing.

Try it with your WordPress site

KiviDB speaks the Redis protocol, so the object-cache plugin doesn't need changing. Run it and point the plugin at it:

docker run -d --name kividb -p 6379:6380 \
  -v kividb-data:/home/kividb \
  kividb/kividb:v1.2.2-lua --requirepass "change-me"

// wp-config.php
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_PASSWORD', 'change-me' );

Use the -lua image if you set WP_REDIS_PREFIX or selective flushing: the Redis Object Cache plugin flushes prefixed keys with a small Lua script. Then load-test a staging copy of your site at your real peak concurrency, and compare page times and the cache server's CPU with what you see today.