CodePark/ questions / Persistence (RDB & AOF)
START PRACTICINGPRACTICE
Backend question · Redis & caching › Persistence (RDB & AOF)

With AOF enabled and appendfsync everysec, roughly how much data can you lose if the server loses power?

About one second of writes

You lose about one second of writes. With everysec, Redis runs fsync (forcing the data from memory onto the disk) on the AOF once per second, in a background thread. So a crash loses around the last second of writes.

The other settings:

•
always fsyncs on every write. It is the safest and the slowest. That is the only way to get "Nothing, every write is fsynced".
•
no leaves flushing to the operating system. That is where a longer loss window like "Up to the OS flush interval, often 30 seconds" comes from.

"Everything since the last RDB snapshot" applies to RDB alone, not when AOF is enabled.