Interview › Databases & Caching
What is the difference between Redis persistence options RDB and AOF?
Databases & Caching · Advanced level
Answer
RDB creates point-in-time snapshot files, while AOF appends write commands to a log for replay. RDB is compact and simple but can lose recent writes; AOF improves durability at the cost of disk and write overhead.
Technical explanation
RDB snapshots are compact point-in-time files and are simple to restore.
AOF logs write commands and can reduce data loss depending on fsync policy.
For a pure cache, persistence may be less important; for authoritative Redis data, persistence and backup testing are mandatory.
Hands-on example
Self-managed example:
save 900 1
save 300 10
appendonly yes
appendfsync everysec
Test by writing known keys, forcing restart in staging, and verifying which keys survive.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- What is Redis replication, and how does a replica stay in sync?
- What is Redis Cluster, and how does sharding with hash slots work?
- What is the difference between Redis Sentinel and Redis Cluster?
- How does ElastiCache provide high availability and automatic failover?
- What is a cache hit ratio, and how do you improve it?
- Why are some Redis commands (KEYS, FLUSHALL) dangerous in production?
- What is the difference between Redis as a cache and Redis as a primary datastore?
- How would you use Redis for rate limiting?