RDB, AOF, and what a crash actually costs
Snapshots lose everything since the last one; the append log loses at most a second - and both cost you something.
Open this lesson in the learning hubKey points
- RDB writes a point-in-time snapshot by forking a child process, so the parent keeps serving while it is written.
- The Redis 7 default save points are
save 3600 1,save 300 100andsave 60 10000- the last snapshot may be an hour old. - AOF appends every write command to a log;
appendonlyships asno, so it is opt-in. appendfsyncdefaults toeverysec, so an unexpected shutdown loses up to one second of writes.appendfsync alwaysfsyncs before replying, which is durable and dramatically slower on real disks.- Redis 7.0 split the AOF into a base file plus incremental files inside the
appenddirnamedirectory.
RDB gives fast recovery, AOF with everysec caps the loss at a second, and most durable setups run both.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Redis Course course, and every lesson in it is listed on the Redis Course contents page.