In Redis, there are two options for persisting data: AOF (Append-Only File) and RDB (Redis Database Snapshot). In a production environment, it's common to configure both, but many developers may wonder:

"Since AOF records data in real-time, does RDB configuration really matter?" "Isn't RDB unnecessary since AOF has recovery priority anyway?"

However, RDB is indeed essential in real-world production environments. Let's explore why.

Redis RDB vs AOF Infographic


1. AOF Files Can Become Corrupted

AOF records every change, but there is a risk of file corruption. If the AOF file becomes corrupted due to disk errors, operational failures, or improper file movements, recovery can be challenging.

redis-server --appendonly yes

If the AOF file is damaged when starting Redis again, it may be impossible to restore the data. In such cases, having an RDB backup allows for at least minimal data recovery.

What if you only use AOF and the file gets corrupted? Increased risk of data loss

What if you have RDB? It's possible to recover at least minimal data


2. AOF Recovery Speed is Slow

AOF must replay each change one by one to recover. The more data there is, the longer the recovery time when restarting Redis.

For example, if the AOF file is 2GB, Redis must execute millions of SET commands. In contrast, RDB can recover much faster simply by loading a dump file.

What if you only use AOF? Risk of longer recovery time

If you use RDB together? Fast recovery possible


3. RDB is Beneficial for Backups and Server Migration

When backing up data in a production environment, AOF has a large file size and is in log format, making it difficult to utilize. In contrast, RDB has a smaller file size and can preserve the data at a specific point in time, making backups much easier.

✔ Example of backing up using RDB:

cp /var/lib/redis/dump.rdb /backup/dump-2025-02-17.rdb

✔ Example of migrating data to another server:

scp /var/lib/redis/dump.rdb new-server:/var/lib/redis/

AOF is harder to back up as data volume increases

RDB is advantageous for quickly backing up and restoring data at a specific point in time


4. Reduces Disk I/O Load

AOF needs to write every change to disk, resulting in a high disk I/O load. In contrast, RDB only saves once per set period, thus reducing disk load.

If you only use AOF? Possible increase in disk load

If used in conjunction with RDB? Optimization of performance is possible


5. Recommended RDB + AOF Configuration in Production

For a production environment, the following configuration is recommended.

# RDB snapshot settings (save data to disk when conditions are met)
# save <seconds> <changes> [<seconds> <changes> ...]
save 900 1 300 10 60 10000 
# Save if there is at least one key change in 900 seconds (15 minutes) or more than 10 key changes in 300 seconds (5 minutes) or more than 10,000 key changes in 60 seconds (1 minute)

# Activate AOF
appendonly yes
appendfsync everysec  # Write to disk every second to balance performance and stability

# Auto-optimize AOF file size (rewrite)
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

🔍 How are multiple save conditions evaluated?

In Redis, all save conditions operate as OR conditions. This means that if any one condition is satisfied, the snapshot will be saved.

✔ Example 1: If save 900 1 and save 60 10000 are set - If there is at least one key change in 900 seconds or - If there are more than 10,000 key changes in 60 seconds - then the RDB snapshot will be saved.

✔ Example 2: If the save 300 10 condition is added - If there are more than 10 key changes in 300 seconds or - If there is at least one change in 900 seconds or - If there are more than 10,000 key changes in 60 seconds - then the RDB snapshot will be saved.

All save options are evaluated as OR conditions

If any one condition is satisfied, RDB will be saved immediately


Conclusion: RDB is Definitely Necessary Even with AOF

AOF alone does not provide perfect data protection

If AOF is corrupted, RDB serves as the final backup

The slow recovery speed of AOF can be mitigated by utilizing RDB for fast recovery

RDB is advantageous for backup and server migration

It can help reduce disk I/O load and optimize performance

The save configuration operates as an OR condition, so if any condition is met, RDB will be saved

Therefore, in a production environment, configuring both RDB and AOF together is the safest and most optimal method.


Search for `Redis` using the search bar on the right! Other posts related to Redis are available. 

Check out the previous post containing an analysis of the AOF Rewrite feature.

Redis AOF Rewrite: Performance Optimization and Data Preservation