Home / How-to / How to Improve WordPress Performance with Redis Object Cache

How to Improve WordPress Performance with Redis Object Cache

How to Improve WordPress Performance with Redis Object Cache | Photo by Peter Robbins on Unsplash
Table of Contents
  1. What Is Redis Object Cache and How Does It Work?
  2. Key Benefits of Redis for WordPress Performance
  3. Step-by-Step: How to Set Up Redis Object Cache for WordPress
  4. Common Questions — Redis Object Cache for WordPress
  5. Conclusion

If your WordPress site still queries the database on every single page load, you’re leaving significant performance on the table. Database queries are one of the most expensive operations a WordPress site performs — and on high-traffic sites, they become the primary bottleneck. Redis is an in-memory data store that caches the results of expensive database queries, returning them in microseconds instead of milliseconds. Studies from Cloudflare and WP Engine show that Redis object caching can reduce WordPress database load by 60-80%. This guide explains exactly how to improve WordPress performance with Redis object cache, from installation to real-world configuration.

A tidy desk setting with a laptop showing a stock photo website and a smartphone. — Photo by Lisa from Pexels on Pexels

What Is Redis Object Cache and How Does It Work?

WordPress has a built-in object cache API that stores query results in memory for the duration of a single page request. By default, this cache is non-persistent — it disappears as soon as the request ends, and the next request starts from scratch. Redis (Remote Dictionary Server) provides a persistent object cache backend, meaning cached data survives across multiple requests and multiple users.

When a user visits your site, WordPress first checks Redis for the data it needs (menu items, widget settings, transients, post metadata). If the data exists in Redis (a “cache hit”), WordPress returns it instantly without touching MySQL. If not (a “cache miss”), it queries MySQL, returns the result, and also stores it in Redis for future requests. Over time, cache hit rates of 80-95% are achievable on content-heavy WordPress sites.

Redis vs Memcached for WordPress

Both Redis and Memcached can serve as WordPress object cache backends. Redis is strongly preferred because it supports data persistence (data survives Redis restarts), richer data structures (lists, hashes, sets), and built-in clustering for high-availability setups. Memcached is simpler but loses its cache on every restart. For WordPress, the Redis Object Cache plugin by Till Krüss is the de facto standard with over 100,000 active installations.

Key Benefits of Redis for WordPress Performance

A person browsing photos on a laptop at a round table with a mug and plants inside. — Photo by cottonbro studio on Pexels

Implementing Redis object cache delivers measurable improvements across multiple performance dimensions:

  • Faster TTFB (Time to First Byte): Redis cache hits return data in under 1ms vs 10-50ms for MySQL queries, directly improving TTFB scores in Google PageSpeed Insights and Core Web Vitals.
  • Reduced CPU usage: Fewer MySQL queries means less CPU work for query parsing, execution, and result set handling — critical on shared or low-spec VPS plans.
  • Lower RAM pressure on MySQL: MySQL’s InnoDB buffer pool is less stressed when Redis intercepts repetitive queries, freeing memory for more complex queries.
  • Better performance under load: During traffic spikes, Redis absorbs the read load that would otherwise flood MySQL and cause query queuing and timeouts.
  • WooCommerce and membership sites: Dynamic sites that can’t use full-page caching benefit enormously from object caching, since every logged-in user generates unique page renders.

For more deep-dive performance analysis, see our WordPress performance deep dives.

Step-by-Step: How to Set Up Redis Object Cache for WordPress

Step 1: Install Redis Server

On Ubuntu 24.04, run the following command. Redis will start automatically after installation:

sudo apt update && sudo apt install redis-server -y

Verify it’s running with:

sudo systemctl status redis-server

Step 2: Configure Redis for WordPress Use

Edit /etc/redis/redis.conf and set maxmemory 256mb (adjust based on your VPS RAM) and maxmemory-policy allkeys-lru to evict least-recently-used keys when memory is full. Also set supervised systemd for proper service management.

Step 3: Restart Redis to Apply Config

Restart the Redis service and verify the configuration loaded correctly:

sudo systemctl restart redis-server
redis-cli config get maxmemory

Step 4: Install the Redis Object Cache Plugin

Install Till Krüss’s Redis Object Cache plugin via WP-CLI — the most reliable option available:

wp plugin install redis-cache --activate

Step 5: Add Redis Configuration to wp-config.php

Add these lines above the “That’s all, stop editing” comment in wp-config.php. For added security, also define the database index:

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);

Step 6: Enable the Object Cache Drop-In

Run the following via WP-CLI, or go to Settings → Redis in the WordPress admin and click “Enable Object Cache”. This creates the wp-content/object-cache.php drop-in file:

wp redis enable

Step 7: Verify Redis Is Connected

Check that Redis is connected and active. You should see “Status: Connected” and the Redis server version:

wp redis status

In the admin panel, the Redis status widget shows real-time hit/miss ratios.

Step 8: Test Performance Before and After

View cache statistics, or install the Query Monitor plugin to observe the drop in database queries per page load. A typical WordPress homepage might drop from 30+ queries to 5-8 with Redis fully warmed up:

wp redis info

For full configuration options, refer to the Redis Object Cache plugin documentation on WordPress.org.

Common Questions — Redis Object Cache for WordPress

Does Redis replace a page cache plugin like WP Super Cache?

No — Redis object cache and page caching solve different problems. Page cache (WP Super Cache, LiteSpeed Cache) stores complete HTML responses for anonymous visitors. Redis object cache stores PHP object results (database queries, transients) for WordPress’s internal use. For maximum performance, use both: Redis for dynamic object caching and a page cache plugin for anonymous visitor requests.

How much memory should I allocate to Redis for WordPress?

A good starting point is 10-15% of your total VPS RAM. On a 2GB VPS, set maxmemory 256mb or maxmemory 300mb. Most WordPress sites’ object cache footprints are well under 100MB. Always set maxmemory-policy allkeys-lru so Redis gracefully evicts old data rather than returning errors when memory is full.

Will Redis work on shared hosting?

Most shared hosting plans do not provide Redis access. You need a VPS, cloud server, or a managed host that explicitly offers Redis (e.g., Kinsta, WP Engine, Cloudways). On a self-managed VPS, Redis is free, easy to install, and one of the highest-ROI performance improvements you can make.

What happens to WordPress if Redis goes down?

WordPress degrades gracefully when Redis is unavailable. The Redis Object Cache plugin detects the disconnection and automatically falls back to the default non-persistent in-memory cache for that request. Your site continues to function normally — it just queries MySQL directly until Redis recovers. Always monitor Redis uptime with a tool like UptimeRobot or your server’s systemd alerts.

Conclusion

Redis object cache is one of the most impactful single changes you can make to a WordPress site’s performance. Here are the three key takeaways:

  • Redis reduces database load by 60-80% by caching query results in memory, dramatically improving response times and scalability.
  • Always set maxmemory and maxmemory-policy allkeys-lru in your Redis config to prevent memory overflow on production servers.
  • Redis and page caching are complementary — use both for maximum performance across both logged-in and anonymous user traffic.

Ready to take your optimization further? Explore our complete WordPress performance guides for Nginx caching, CDN setup, and database optimization. Share your Redis hit rate in the comments — what percentage are you achieving?


See also: How-To Guides: Practical Technology Tutorials for 2026 — browse all How-to articles on Hubkub.

Last Updated: April 13, 2026

TouchEVA

TouchEVA

Founder and lead writer at Hubkub. Covers software, AI tools, cybersecurity, and practical Windows/Linux workflows.

Tagged: