• RDB (Redis Database): The RDB persistence performs point-in-time snapshots of your dataset at specified intervals.
• AOF (Append Only File): The AOF persistence logs every write operation received by the server.
• No persistence: If you wish, you can disable persistence completely.
• RDB + AOF: It is possible to combine both AOF and RDB in the same instance.
• RDB is a very compact single-file point-in-time representation of your Redis data.
• RDB is very good for disaster recovery.
• RDB maximizes Redis performances since the only work the Redis parent process needs to do in order to persist is forking a child that will do all the rest. The parent process will never perform disk I/O or alike.
• RDB allows faster restarts with big datasets compared to AOF.
• RDB is NOT good if you need to minimize the chance of data loss in case Redis stops working.
• RDB needs to fork() often in order to persist on disk using a child process.
• Using AOF Redis is much more durable: you can have different fsync policies: no fsync at all, fsync every second, fsync at every query.
• The AOF log is an append-only log, so there are no seeks, nor corruption problems if there is a power outage.
• Redis is able to automatically rewrite the AOF in background when it gets too big. T
• AOF contains a log of all the operations one after the other in an easy to understand and parse format.
• AOF files are usually bigger than the equivalent RDB files for the same dataset.
• AOF can be slower than RDB depending on the exact fsync policy.
Ok, so what should I use?
The general indication you should use both persistence methods is if you want a degree of data safety comparable to what PostgreSQL can provide you.
If you care a lot about your data, but still can live with a few minutes of data loss in case of disasters, you can simply use RDB alone.
There are many users using AOF alone, but we discourage it since to have an RDB snapshot from time to time is a great idea for doing database backups, for faster restarts, and in the event of bugs in the AOF engine.