Advertisement
Intermediate Redis, Persistence (RDB/AOF)

What are the different appendfsync options available for AOF persistence, and how do they balance durability against performance?

Short answer

The always option writes and flushes to disk after every single write command, providing the strongest durability but the slowest performance, everysec flushes to disk once per second, offering a reasonable balance most applications choose by default, and no relies on the…

Save Redis mock interview
Advertisement
AModel answer
The always option writes and flushes to disk after every single write command, providing the strongest durability but the slowest performance, everysec flushes to disk once per second, offering a reasonable balance most applications choose by default, and no relies on the operating system to decide when to flush, offering the best performance but the weakest durability guarantee.
Example

CONFIG SET appendfsync everysec -- a common balanced default

Real-world example
A team evaluating their durability requirements chooses the everysec setting as a reasonable balance, accepting the small risk of losing up to one second of writes during a crash in exchange for meaningfully better performance than the always option.
Likely follow-ups
  • How much data could actually be lost with the everysec setting during a crash?
  • When would the always setting actually be necessary despite its performance cost?
Related topics