Redis use cases on a VPS cluster around three jobs: caching, sessions, and queues. They look different on the surface, but they all use the same strength: Redis answers from memory in microseconds, while a database on the same small server answers from disk in milliseconds. The trick is picking the right job for your app and configuring Redis for that job, because a cache, a session store, and a queue want different persistence and eviction settings.
This guide explains each use case with a real setup, so you can tell which one your VPS needs first. If you have not installed Redis yet, start with the install guide, then come back here. The three patterns below also combine well: many small apps run all three on one Redis instance with separate key prefixes.
Redis Use Cases on a VPS: Caching First
Caching is the most common Redis job on a VPS, and the one with the fastest payoff. A WordPress site that runs the same expensive query on every page load can store the result in Redis for a few minutes and skip the database entirely. The database load drops, the page loads faster, and the VPS stops struggling during traffic spikes.
The pattern is simple. The app checks Redis for a key. On a hit, it uses the cached value. On a miss, it queries the database, stores the result in Redis with an expiry, and returns it. The expiry is the important part: five minutes for a homepage fragment, an hour for a product list, a day for a rarely changed setting. Stale data is the price of a cache, so pick an expiry that matches how fast the data changes.
For WordPress, the object cache does this without code changes. Install the Redis server, add the object cache plugin, and WordPress stores query results and computed objects in Redis automatically. This guide to installing a Redis object cache on a WordPress VPS covers the setup. Full-page caching is a different layer: Nginx FastCGI cache or a plugin handles the HTML, while Redis handles the objects behind it. This walkthrough of Nginx FastCGI cache for WordPress shows how the two layers fit together.
Cache settings are forgiving. Use maxmemory-policy allkeys-lru so Redis evicts the least recently used keys when it fills up, and set a maxmemory limit that leaves room for the rest of the server. RDB snapshots are enough persistence for a cache: if the data vanishes, the app rebuilds it. The one rule that matters is that every cache key gets an expiry, because a cache without expiry is a memory leak.
Sessions: One Login Across Every Request
PHP and most frameworks store sessions on disk by default, which breaks as soon as you run two servers or restart PHP-FPM and lose the session files. Redis fixes this by holding sessions in memory, where every web server can reach them. The user logs in once, and every request after that finds the session in Redis instead of on one server’s disk.
For PHP, the setup is two lines in php.ini:
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?auth=your-password"
Restart PHP-FPM and log in to your app. The session now lives in Redis, and you can confirm it with redis-cli KEYS "PHPREDIS_SESSION:*". The keys appear as users log in and disappear when they expire, which is exactly the behavior you want.
Sessions want different Redis settings than a cache. Set the eviction policy to volatile-lru so Redis only evicts keys that have an expiry, and never evict a live session to make room for a cache entry. Better still, run sessions and caching in separate Redis databases on the same instance: database 0 for the cache, database 1 for sessions. They share the server but not the keyspace, so a cache flush cannot log everyone out.
One warning: if Redis restarts, every session dies and every user has to log in again. For a small app that is an acceptable trade, and it is far better than sessions that randomly break across servers. If logouts after a restart are unacceptable, turn on AOF persistence so sessions survive a restart, or keep sessions in the database and use Redis only for the cache.
Queues: Background Work Without a Second Server
A queue is the third job, and the one that saves a small VPS from the most pain. Sending email, generating a PDF, resizing an image, or calling a slow API does not belong in a web request. The request should push a job onto a queue and return immediately, while a worker process picks jobs up in the background.
Redis lists make a simple queue. The app pushes a job with LPUSH and the worker blocks on BRPOP until a job arrives. That is enough for a small app with one worker. Larger apps use a library instead: Laravel uses Redis queues natively, Sidekiq uses Redis for Ruby, and BullMQ uses Redis for Node. The library handles retries, failed jobs, and delayed jobs, which a hand-rolled list does not.
A queue worker is just a long-running process, and on a VPS it needs a process manager. Supervisor is the usual choice: it starts the worker at boot, restarts it if it crashes, and keeps the logs in one place. Give the worker a sensible concurrency: two workers on a 2 GB VPS, four on a 4 GB box. More workers do not make a slow job faster; they just compete for the same CPU and memory.
Queue settings differ from the other two jobs. A queue must not lose jobs, so turn on AOF persistence with appendfsync everysec and use maxmemory-policy noeviction. If Redis fills up, it should return errors instead of silently dropping queued jobs, because a dropped job is a lost order or an unsent email. Monitor the queue length with LLEN and alert when it grows past a threshold you pick: a queue that keeps growing means the workers cannot keep up, and the fix is faster jobs or more workers, not a bigger queue.
Pub/Sub and Rate Limiting: The Smaller Jobs
Two smaller jobs round out the list. Pub/sub lets one process publish a message and every subscribed process receive it, which is handy for live notifications or cache invalidation across servers. A web server publishes user:42:updated and every other server drops its cached copy. Pub/sub messages are fire-and-forget: if no subscriber is listening, the message is gone, so do not use it for anything you cannot afford to lose.
Rate limiting is the other one. A login form that allows five attempts per minute per IP is a sorted set or a counter with an expiry. Redis handles this in a single atomic command, so it stays correct under concurrent requests where a database table would race. It is a small job, but it is the kind of thing that is awkward everywhere else and trivial in Redis.
One Instance or Three?
A single Redis instance can run all three jobs on a small VPS, and that is the right starting point. Use separate databases or key prefixes, set the eviction policy per job, and give the whole instance a memory limit that fits the server. Split into separate instances only when the jobs start fighting: a cache that fills memory and evicts sessions, or a queue that needs noeviction while the cache needs allkeys-lru. At that point, run two Redis processes on different ports with their own config files.
When Redis itself becomes the bottleneck, the usual answer is not a bigger Redis but less work for it. A cache hit rate under 80 percent means the app caches the wrong things. A queue that never drains means the jobs are too slow. A session store that grows forever means sessions never expire. Fix the app first; the server is rarely the problem.
If you would rather not run Redis at all, managed hosting is an option, and this comparison of managed Redis hosting for small projects lists the trade-offs. Memcached is the other alternative for a plain cache: it does less than Redis, uses less memory, and is simpler to run. This Redis versus Memcached comparison helps you pick. For most VPS owners, one Redis instance doing caching first, sessions second, and queues third covers the real needs, and it costs a few hundred megabytes of RAM.