Redis's persistence model is configurable: none, snapshots (RDB), append-only log (AOF), both. The right choice depends on what 'losing data' costs you and how much RAM/disk you have to spare.

Advertisement

RDB — periodic snapshots

Forks the process, writes a binary snapshot every N minutes. Fast restore. Can lose up to N minutes of writes on crash. Right for caches with regeneration logic, sessions where loss is acceptable.

AOF — append-only log

Every write goes to a log file. Fsync policy controls durability vs perf (every write, every second, OS default). Slower writes. Replay on restart can take minutes for large datasets.

Advertisement

Both, or none

Production with valuable data: AOF + RDB (snapshot for fast restore, AOF for low data loss). Pure cache: none (saves disk, restart re-warms from source of truth). Hybrid: AOF every-second is the common safe default.

Pure cache: none. Sessions: RDB. Valuable data: AOF + RDB. Fsync policy is the durability/perf knob.