Redis Medium technical 1 views 1 min read

How does Redis persistence work with RDB and AOF?

Peer-reviewed by HireXTech Technical Panel Updated for 2025/2026 hiring Editorial standards
Practise this track
Interviewer Expectations for this Question
01
Core Competency

Assesses fundamental understanding of Redis conventions, runtime behavior, and memory/performance considerations.

02
Evaluation Criteria

Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.

Comprehensive Model Answer Verified Solution

Redis offers two persistence mechanisms.

RDB takes point-in-time snapshots at configured intervals, for example save 900 1 snapshots after 900 seconds if at least one key changed. RDB files are compact and fast to load, which is good for backups and restarts, but a crash loses writes since the last snapshot.

AOF appends every write command to a log. With appendfsync everysec Redis fsyncs once per second, a good balance; always is slowest but safest; no lets the OS decide. AOF grows over time and is compacted by rewrite, and you can enable AOF and RDB together.

On restart Redis prefers AOF because it is usually more complete. For pure caches you may disable persistence entirely and rely on the source of truth. Always test the restore path, not just the backup.

Candidate Response Strategy & Interview Tips

  1. Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
  2. Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
  3. Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
  4. Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.
Related Topics & Skills
Spotted an error or have an alternative solution?