Skip to content

Durability Tradeoffs

AOF durability depends on how often Redis flushes the AOF buffer to disk. The appendfsync directive controls this with three modes:

  • always: fsync after every command — zero data loss, lowest throughput
  • everysec: fsync once per second — at most 1 second of data loss, good balance (recommended)
  • no: OS decides when to flush — highest throughput, unpredictable data loss
# Maximum durability — every write fsynced
appendfsync always
# Balance — at most 1 second of data loss (recommended)
appendfsync everysec
# Fastest — OS controls flushing, unpredictable loss
appendfsync no
ModeMax data lossThroughput
always0 commandsLowest
everysec~1 secondGood
noSince last OS flushHighest
RDB onlySince last snapshotHighest

Running replicas does NOT replace persistence. A replica that crashes and restarts will reload from its own persistence files (or sync from primary). Best practice: enable persistence on replicas independently, not just on the primary.

127.0.0.1:6379> CONFIG GET appendfsync
1) "appendfsync"
2) "everysec"
127.0.0.1:6379> CONFIG SET appendfsync always
OK
127.0.0.1:6379> CONFIG GET appendfsync
1) "appendfsync"
2) "always"
CONFIG GET appendfsync
CONFIG SET appendfsync always
CONFIG GET appendfsync
Which `appendfsync` mode guarantees zero data loss on crash?
Which `appendfsync` mode is recommended for most production deployments?
What is the maximum data loss when using `appendfsync everysec`?
Does running Redis replicas replace the need for persistence on each node?