Our Redis deployment guide covers installing Redis next to an application. This guide is about the next step: a dedicated Redis server that several application servers share, sized and configured for its role, with security and high availability considered from the start.
When to Separate Redis
- The cache competes with the database or application for memory.
- You run several application servers that must share sessions, cache and queues.
- You want to restart or resize the application server without losing cache warmth.
- Queues are critical and need their own monitoring and persistence settings.
Decide the Role First
| Role | Data loss acceptable? | maxmemory-policy | Persistence |
|---|---|---|---|
| Page/object cache | Yes, it can be rebuilt | allkeys-lru or allkeys-lfu | Off, or RDB snapshots for warm restarts |
| Sessions | Minimise (users get logged out) | volatile-lru with TTLs, or noeviction | AOF everysec |
| Job queues | No | noeviction | AOF everysec |
| Rate limiting, counters | Usually yes | volatile-ttl | Optional |
Mixing a disposable cache and a critical queue in one instance forces a compromise. Running two Redis instances (two ports or two containers) on the same server, each configured for its role, is simple and avoids evicting jobs to make room for cache entries.
Sizing Memory
- Measure current usage:
redis-cli INFO memoryshowsused_memoryand the fragmentation ratio. - Estimate growth over the next year.
- Add 20–30% for fragmentation, client buffers and replication buffers.
- If you use RDB snapshots or AOF rewrites, Redis forks; copy-on-write can temporarily need extra memory proportional to how much data changes during the save.
- Set
maxmemoryto leave room for all of the above plus the OS.
Example: a 6 GB dataset with persistence fits comfortably on a 16 GB server with maxmemory 10gb.
CPU Considerations
Redis executes commands on one main thread, so per-core speed matters more than core count for raw command throughput. Redis 6 and later can use I/O threads for network handling (io-threads), which helps at high connection counts. Extra vCores also serve persistence forks, the OS and any second instance. Avoid slow commands on large keys (KEYS *, huge SMEMBERS) that block the main thread; use SCAN instead.
Configuration for a Dedicated Server
# /etc/redis/redis.conf (cache instance)
bind 0.0.0.0 -::* # listen on the network; the firewall restricts who connects
protected-mode yes
requirepass use-a-long-random-password # or ACL users, below
maxmemory 10gb
maxmemory-policy allkeys-lru
save "" # no RDB snapshots for a pure cache
appendonly no
tcp-keepalive 60
For queues and sessions, use maxmemory-policy noeviction, appendonly yes and appendfsync everysec instead.
ACL Users
ACL SETUSER app on >another-long-password ~cache:* +@read +@write -@dangerous
ACL SETUSER admin on >admin-password ~* +@all
Give each application its own user restricted to its key prefix and command categories, and keep administrative access separate. Persist ACLs with an ACL file or ACL SAVE.
Network Security
- Allow port 6379 only from your application servers' IPs (see our UFW guide):
sudo ufw allow from APP_IP to any port 6379 proto tcp. - Never expose Redis to the whole internet; exposed instances are scanned and abused within minutes.
- Encrypt traffic that crosses the public network: Redis supports TLS (
tls-port, certificates) when built with TLS, or run traffic through a WireGuard tunnel between servers. - Rename or disable dangerous commands for application users through ACLs rather than relying on obscurity.
High Availability with a Replica and Sentinel
A single Redis server is a single point of failure. For sessions and queues that must survive a server failure:
- Run a replica on a second server:
replicaof PRIMARY_IP 6379withmasterauthset. - Run three Redis Sentinel processes (for example on the primary, the replica and an app server) that monitor the primary and agree on failover.
- Use a client library that discovers the current primary through Sentinel.
For a disposable cache, a replica is often unnecessary: the application can rebuild the cache from the database after a restart, at the cost of slower responses for a while.
Operating System Settings
# /etc/sysctl.d/90-redis.conf
vm.overcommit_memory = 1
net.core.somaxconn = 1024
Redis's own startup log warns about settings it wants changed, including transparent huge pages; follow its recommendations. Disable swap use for Redis where possible: a swapped cache is slower than no cache.
What to Monitor
| Metric | Source | Watch for |
|---|---|---|
| Used memory vs maxmemory | INFO memory | Approaching the limit |
| Evicted keys | INFO stats | Rising evictions mean the cache is too small (or a queue is being evicted) |
| Hit ratio | keyspace_hits / (hits + misses) | Falling ratio |
| Connected clients | INFO clients | Leaks from apps not closing connections |
| Latency | redis-cli --latency, LATENCY DOCTOR | Spikes from slow commands or forks |
| Replication lag | INFO replication | Growing offset difference |
The Prometheus Redis exporter feeds these into dashboards and alerts (see our monitoring guide).
Client-Side Settings Matter Too
Applications should use connection pools rather than opening a connection per request, set short connect and command timeouts so a Redis problem degrades gracefully, and treat cache misses and errors as a normal path that falls back to the database. Use key prefixes per application and TTLs on cache entries so memory is reclaimed predictably.
Upgrading Redis
Read the release notes, upgrade the replica first, fail over, then upgrade the old primary. For a single cache instance, upgrade during a quiet period and expect the cache to warm up again.
Dedicated Redis Checklist
- Role decided: cache, sessions or queues, with matching eviction and persistence.
- maxmemory set with headroom for forks and buffers.
- Port restricted to app server IPs; ACL users with passwords.
- Traffic encrypted across public networks.
- Memory, evictions, hit ratio and latency monitored.
In Short
Decide the role, size memory with headroom, lock down the network, and monitor evictions and latency; a dedicated Redis server then quietly speeds up everything that uses it.
SkyRainCloud Plans for This Workload
Redis is memory-bound and mostly single-threaded for commands, so buy RAM first: the 16 GB and 32 GB EPYC plans make good dedicated cache servers. Leave memory free for persistence forks and the OS.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.