What is Redis?

Redis is an in memory data store used for caching, sessions, and queues. CloudSonic installs and manages Redis on every server, configured for maximum performance as a WordPress object cache.

CloudSonic
CloudSonic
Last Updated September 10, 2026

TL;DR Redis

Redis is an open source in-memory data structure store that is most commonly used as a cache, message broker, or session store. Unlike traditional databases that read and write data to disk, Redis keeps its entire dataset in RAM which makes it extraordinarily fast, capable of handling millions of operations per second with sub-millisecond response times. For WordPress sites, Redis is used as an object cache, storing the results of database queries in memory so that repeat requests are served instantly without hitting the database again. This reduces database load significantly and makes sites feel much more responsive under traffic. CloudSonic installs and manages Redis on every server, configured with an LRU eviction policy so it never runs out of memory, and connected via a Unix socket for the fastest possible communication with PHP. It integrates directly with managed WordPress hosting and works alongside MariaDB and PostgreSQL as part of the CloudSonic stack.

How Redis Works

Redis stores all of its data in RAM rather than on disk, which is what makes it so fast. Every read and write operation happens in memory at nanosecond speeds rather than the microsecond to millisecond speeds of disk-based databases. Redis supports a rich set of data structures beyond simple key-value pairs, including lists, sets, sorted sets, hashes, and streams, which makes it flexible enough to serve as a cache, a session store, a message queue, a leaderboard, or a pub-sub messaging system depending on how it is used. For WordPress, Redis is used as an object cache. WordPress generates pages by running PHP code that queries the MySQL or MariaDB database repeatedly. With Redis installed, the results of those database queries are stored in Redis after the first execution. Subsequent page loads that require the same data retrieve it from Redis in memory rather than querying the database again, dramatically reducing database load and page generation time.


# Check if Redis is running
redis-cli ping
# Expected output: PONG

# Check Redis memory usage
redis-cli info memory | grep used_memory_human

# Check how many keys are cached
redis-cli dbsize

# Check the object cache hit rate
redis-cli info stats | grep -E 'keyspace_hits|keyspace_misses'

# Flush the Redis cache (use with caution on production)
redis-cli flushall

# Watch Redis commands in real time to confirm WordPress is using the cache
redis-cli monitor

# Output example (shows WordPress object cache reads and writes):
# 1725868412.123456 [0 127.0.0.1:54321] "GET" "wp:alloptions"
# 1725868412.124891 [0 127.0.0.1:54321] "GET" "wp:post_meta:42"
# 1725868412.126234 [0 127.0.0.1:54321] "SETEX" "wp:query:a1b2c3" "3600" "..."
# 1725868412.127891 [0 127.0.0.1:54321] "GET" "wp:user:1"
# Press Ctrl+C to stop monitoring

Why Redis Matters for Your Website

The single biggest performance bottleneck for most WordPress sites is database queries. WordPress generates pages by running PHP that queries the database repeatedly, and on a busy site with many plugins each page load can trigger dozens or even hundreds of database queries. Even on fast hardware with NVMe storage, this adds latency that accumulates across every page load. Redis eliminates the majority of this database load by caching query results in memory. After the first page load, subsequent loads retrieve data from Redis at memory speeds rather than querying the database at all. The difference in response time is significant and directly measurable. Sites that implement Redis object caching typically see TTFB reductions of 50 to 80 percent for cached pages. Under traffic spikes, the database load reduction is even more valuable because it means the database does not become the bottleneck that causes the site to slow down or fall over when visitor numbers surge.

Frequently Asked Questions on Redis

Does Redis persist data if the server restarts?

On CloudSonic, Redis is configured as a pure cache with persistence disabled. This means a server restart clears the Redis cache entirely. This is intentional for a WordPress object cache use case because the cache is rebuilt automatically from the database on subsequent requests. The performance benefit returns within minutes of the server restarting as the cache warms up again.

What is the difference between Redis and Memcached?

Both are in-memory caching systems but Redis supports a much richer set of data structures including lists, sets, sorted sets, and hashes, and it supports optional persistence. Memcached is simpler and slightly faster for pure key-value caching at extreme scale. For WordPress object caching Redis is the better choice because its richer data structures allow more sophisticated caching patterns and it is more widely supported by WordPress caching plugins.

How much memory should Redis be allocated?

CloudSonic configures Redis with a maxmemory limit sized to approximately 25 percent of available server RAM. When that limit is reached, Redis automatically evicts the least recently used keys to make room for new ones, which is the correct behaviour for a cache. This means Redis never consumes more memory than its allocation and never competes with PHP and the database for RAM.

Which WordPress caching plugin works best with Redis?

Redis Object Cache by Till Krüss is the most widely used and best maintained WordPress plugin for connecting WordPress to a Redis object cache. It drops a custom object-cache.php file into the wp-content directory which intercepts WordPress database calls and routes them through Redis. CloudSonic's Redis configuration is compatible with this plugin out of the box.