Redis is an in-memory data store that caches frequently accessed data (database queries, session data, page fragments) in RAM instead of hitting the disk every time. For WordPress, Redis can reduce database queries by 50-80%, making your site noticeably faster.

Is Redis Available on My Plan?

Plan TypeRedis Available?
Shared hostingNo (use LiteSpeed Cache instead)
Managed VPSYes (may need activation)
Dedicated VPSYes (install it yourself)
Cloud hosting (Enhance)Depends on server configuration

Install Redis on a VPS

Ubuntu/Debian

  sudo apt update
sudo apt install -y redis-server
  

Configure Redis

  sudo nano /etc/redis/redis.conf
  

Key settings to change:

  # Bind to localhost only (security)
bind 127.0.0.1

# Set a memory limit (256MB is a good start)
maxmemory 256mb

# Eviction policy (remove least recently used keys when full)
maxmemory-policy allkeys-lru

# Run as a background service
daemonize yes
  

Restart Redis:

  sudo systemctl restart redis-server
sudo systemctl enable redis-server
  

Verify it’s running:

  redis-cli ping
# Should respond: PONG
  

Redis for WordPress

Install the Plugin

  1. Install Redis Object Cache
  2. Activate it
  3. Go to Settings > Redis
  4. Click Enable Object Cache

The plugin connects to Redis automatically if it’s running on localhost with default settings.

Verify It’s Working

Go to Settings > Redis. You should see:

  • Status: Connected
  • Client: PhpRedis or Predis
  • Hits/Misses: Increasing numbers (more hits = working correctly)

Advanced: wp-config.php Settings

If Redis is on a non-default port or you want to customize:

  // Add before "That's all, stop editing!"
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);        // Use a different DB index per site
define('WP_REDIS_PREFIX', 'mysite_');   // Prefix for multisite or multiple WP installs
  

Redis for Multiple WordPress Sites

If you’re running multiple WordPress sites on one VPS, give each site its own Redis database index:

Site 1 (wp-config.php):

  define('WP_REDIS_DATABASE', 0);
  

Site 2 (wp-config.php):

  define('WP_REDIS_DATABASE', 1);
  

Redis supports databases 0-15 by default.

Monitoring Redis

  # Check memory usage
redis-cli info memory

# Check connected clients
redis-cli info clients

# Watch commands in real-time
redis-cli monitor

# Check hit/miss ratio
redis-cli info stats | grep keyspace
  

Key Metrics to Watch

MetricGood ValueWhat It Means
used_memory_humanUnder your maxmemory limitHow much RAM Redis is using
keyspace_hits / missesHigh ratio (90%+)Cache effectiveness
connected_clientsUnder 100Number of active connections
evicted_keysLow or zeroKeys removed due to memory pressure

Troubleshooting

ProblemFix
Plugin shows “Not connected”Check Redis is running: sudo systemctl status redis-server
Redis running but plugin can’t connectInstall the PhpRedis extension: sudo apt install php-redis then restart PHP
High memory usageLower maxmemory or check for bloated transients in WordPress
Redis crashes under loadIncrease maxmemory or check system RAM with free -h

Redis vs Memcached

Both are in-memory caching systems. For WordPress:

FeatureRedisMemcached
Data persistenceYes (survives restart)No
Data structuresStrings, lists, sets, hashesStrings only
WordPress plugin supportBetter (more popular)Good
Multi-databaseYes (0-15)No
RecommendationUse thisOnly if Redis isn’t available

Last updated 19 Apr 2026, 23:46 +0300. history

Was this page helpful?