Scrivio Interview library
DesignAdvanced7 min read · updated 12 November 2026

Define backup, persistence and recovery standards for 150 Redis deployments used for caches, sessions, rate limits and a few queues. What differs per use case, and how do you test recovery?

We classify the 150 deployments by how much data loss they can tolerate: caches need no persistence, sessions accept a small loss, and queues or anything used as a source of truth need AOF everysec, replicas and backups. Each class gets standard settings as managed configuration, backups of RDB files taken from replicas to encrypted object storage with retention per class, and written RPO and RTO targets. We test recovery by regularly restoring into a fresh instance and measuring the load time, and we document how each application behaves when data is lost.

Why this question is asked

With a handful of Redis instances, each team can tune its own. With 150, ad hoc choices become a risk: some caches pay for persistence they do not need, some queues run without backups, and nobody knows how long a restore would take until the day it is needed. Interviewers ask this design question to see whether we can turn knowledge of Redis persistence into standards that scale, and whether we treat recovery as something to test, not assume. In this answer, we will define the classes, set the configuration per class, design backups, write and test recovery objectives, and describe the application behaviour each class relies on.

1A Quick Recap of the Building Blocks

Redis offers RDB snapshots, compact point-in-time files, and AOF, a log of every write fsynced every second by default. Replicas copy a primary asynchronously and can take over on failure, which keeps the service available but can lose the last writes. A backup is a copy of the data stored somewhere else, such as object storage, that survives the loss of the whole deployment.

Two numbers express what the business needs. RPO, the recovery point objective, is how much recent data we can afford to lose, for example one hour. RTO, the recovery time objective, is how long we can be down, for example 15 minutes. Every choice in this design trades cost against these two numbers.

2Classifying the Deployments

The starting point is not the technology but the data. We ask each owning team one question: if this Redis lost all its data now, what would happen? The answers fall into a few classes.

Caches hold copies of data that lives elsewhere; losing them means a slower period while they refill. Rate limit counters are similar: losing them briefly lets a few extra requests through. Sessions are more sensitive: losing them logs users out, which is annoying but tolerable if rare. Queues and anything a team treats as a source of truth are different: losing them loses work or records that exist nowhere else. In a typical estate of 150, most deployments are caches and limits, a good share are sessions, and only a handful are queues.

Standards per class
ClassPersistenceReplicas and backupsRPO / RTO
Cachenone1 replica for availability, no backuploss accepted / refill in minutes
Rate limitnone1 replica, no backuploss accepted / 5 min
SessionRDB hourly or AOF everysec1 replica, daily RDB backup1 h / 15 min
Queue or source of truthAOF everysec plus RDB2 replicas, hourly backupsabout 1 s on crash / 15 min
Each class is a named configuration profile, not a set of manual settings.

3Standard Settings as Managed Configuration

Each class becomes a configuration profile managed in code, through Terraform, Helm values, an operator, or the settings of a managed service. The profile fixes the persistence mode, appendfsync, the maxmemory headroom, the number of replicas and the eviction policy. A team creating a new deployment chooses a class, not forty settings.

Some settings follow directly from the class. Caches use allkeys-lru or allkeys-lfu, so a full cache evicts old entries instead of rejecting writes. Queues and sources of truth use noeviction, so Redis never silently drops data; a full instance returns errors, and an alert fires long before that. Persistent classes keep maxmemory well below the machine's RAM, because forks for snapshots need room for copy-on-write. Drift from the profile is detected automatically, by comparing CONFIG GET output with the profile, and reported to the owning team.

Text
# Profile: queue (applied by the platform, not by hand)
appendonly yes
appendfsync everysec
aof-use-rdb-preamble yes
save 3600 1 300 100
maxmemory 24gb # on a 48 GB machine: headroom for forks
maxmemory-policy noeviction # never drop queue data silently
min-replicas-to-write 1 # refuse writes if no replica is connected
min-replicas-max-lag 10

4Designing the Backups

For the classes that need them, we take backups from replicas, not primaries, so the fork and disk I/O of a snapshot never disturb the primary's latency. A scheduled job triggers BGSAVE on a replica, waits for it to finish, copies the RDB file to object storage, and records its size and checksum. Files are encrypted at rest, because sessions and queues often contain personal data, and access is limited to the platform team.

Retention follows the class: sessions might keep seven daily copies, queues 48 hourly copies and 30 daily ones. Object storage lifecycle rules delete older copies automatically. A backup that fails, or that is suspiciously smaller than the last, raises an alert.

Step throughNightly backup of a session deployment
  1. Trigger BGSAVE on the replicaprimary is not forked
  2. Wait for rdb_bgsave_in_progress to be 0and status ok
  3. Copy dump.rdb to object storageencrypted, tagged with class and time
  4. Size within 20 percent of the last backup?
    YesRecord successNoAlert the owners
  5. Lifecycle rule deletes copies past retention7 days for sessions

5 steps in order. Play them, or step through them one at a time.

5Testing Recovery

A backup we have never restored is a hope, not a plan. So each persistent class has a recurring restore test, automated where possible. Monthly for queues and quarterly for sessions, a job takes the latest backup, starts a fresh Redis instance, loads the file, and checks the key count and a few known keys. It measures how long the load takes, because that is the real RTO: a 30 GB RDB file may take minutes to load, and an AOF without the RDB preamble may take much longer.

We also rehearse the larger failures: losing a primary to see failover time and how many writes the applications noticed missing, and losing a whole deployment to restore from object storage. The results are written down per class, and when a test misses its RTO we act: smaller instances, faster disks, or a change of class.

6Documenting Application Behaviour on Data Loss

The last part of the standard lives in the applications. For each class we document what the application does when Redis comes back empty or with older data. Caches refill from the database, ideally with protection against every key being loaded at once. Users with lost sessions log in again, which the login flow must handle gracefully. Queue consumers reconcile with the source system, for example by re-reading orders created after the backup time, so work is not lost silently.

This documentation turns a recovery from improvisation into a checklist, and it often reveals that a deployment has the wrong class: a cache that actually holds data found nowhere else is a queue in disguise.

7Follow-up questions

Which class would you push off Redis entirely?

The source-of-truth class. If a team keeps records that exist nowhere else in Redis, I would push them towards a durable database and keep Redis as a fast view. Queues with strict delivery needs are also candidates for a dedicated broker such as Kafka or a database-backed outbox, because asynchronous replication can lose acknowledged messages during failover.

Why take backups from replicas rather than primaries?

Because BGSAVE forks the process, and the fork pause plus copy-on-write memory and disk I/O affect latency. A replica has the same data, slightly behind, and nobody's requests wait on it. The cost is that the backup may miss the last moments of replication lag, which is acceptable for our RPOs.

What does min-replicas-to-write add for queues?

It makes the primary refuse writes when fewer than the given number of replicas are connected and recently in sync. A queue producer then gets an error instead of a write that exists on one machine only. It reduces, but does not eliminate, the writes that a failover can lose, because replication is still asynchronous.

8Conclusion

In this answer, we designed standards for 150 Redis deployments by classifying them by data loss tolerance: caches and rate limits without persistence, sessions with light persistence and daily backups, and queues or sources of truth with AOF everysec, replicas and frequent backups. Each class is managed configuration with its persistence, headroom, replicas and eviction policy. Backups come from replicas to encrypted object storage with retention per class, RPO and RTO are written per class and tested by restoring into fresh instances and measuring load time, and each application documents its behaviour after data loss.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by classifying the 150 deployments by data loss tolerance, asking each owner what happens if their Redis loses everything. Caches and rate limits can lose data, so they get no persistence, just a replica for availability and an allkeys-lru or lfu eviction policy.

Then, if they want more

Sessions accept a small loss, so they get light persistence, a replica and daily backups. Queues and anything used as a source of truth get AOF everysec plus RDB, two replicas, noeviction, min-replicas-to-write, and frequent backups.

Each class becomes a managed configuration profile in code, covering persistence mode, maxmemory headroom for forks, replica count and eviction policy, with drift detection, so teams choose a class rather than tune settings.

Backups are RDB files taken from replicas, so the primary never forks, copied to encrypted object storage with retention per class and alerts on failed or unusually small backups.

Every class has a written RPO and RTO, and we test them by regularly restoring the latest backup into a fresh instance, checking the data and measuring the load time, which is the real RTO. Finally, I document application behaviour on loss: caches refill, sessions re-login, queues reconcile from the source system. And I would push true sources of truth off Redis entirely.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Redis documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Define backup, persistence and recovery standards for 150 Redis deployments used for...": https://scrivio-interview-library.netlify.app/databases/redis/ea780747a1/