Advertisement
Beginner Redis, Persistence (RDB/AOF)

What is AOF, or append only file, persistence, and how does it differ from RDB snapshots?

Short answer

AOF persistence logs every write operation to a file as it happens, rather than periodically saving the entire dataset at once like RDB, meaning it can offer much better durability with less potential data loss since nearly every write is recorded individually, though the…

Save Redis mock interview
Advertisement
AModel answer
AOF persistence logs every write operation to a file as it happens, rather than periodically saving the entire dataset at once like RDB, meaning it can offer much better durability with less potential data loss since nearly every write is recorded individually, though the resulting log file can grow significantly larger than an equivalent RDB snapshot.
Example

CONFIG SET appendonly yes CONFIG SET appendfsync everysec

Real-world example
A financial application enables AOF persistence to minimize the risk of losing recent transactions, accepting the larger file size in exchange for the much stronger durability guarantee it provides over RDB snapshots alone.
Likely follow-ups
  • What does the appendfsync setting control, and what are the different options?
  • Can RDB and AOF persistence be used together at the same time?
Related topics