1. Differences Between Traditional AOF and AOF-RDB Hybrid Method

AOF (Append-Only File) is one of the persistence methods of Redis, which records data changes to a file for the purpose of data recovery in case of failures.
๐Ÿ‘‰ For a detailed explanation of AOF concepts, it is recommended to check the previous post
Redis AOF Rewrite: Performance Optimization and Data Preservation first.

This article focuses on analyzing the differences between the traditional AOF method and the AOF-RDB Hybrid method introduced in Redis 7.0 and above.


2. Redis 7.0 and Above: Introduction of AOF-RDB Hybrid Method

To address the inefficient disk usage and slow recovery speed issues of the traditional AOF method, Redis 7.0 and above has adopted the AOF-RDB Hybrid method as the default.
This method combines RDB snapshots with AOF to store data in a more optimized way.

โœ… How AOF-RDB Hybrid Method Works

  1. Storing the initial state โ†’ When Redis saves AOF, it first creates an RDB snapshot and stores it in the appendonly.aof.X.base.rdb file.
  2. Subsequent changes are stored โ†’ All subsequent changes are recorded in the appendonly.aof.X.incr.aof file.
  3. During data recovery โ†’ When Redis restarts, it first loads the RDB and then reflects the AOF delta to restore to the latest state.

3. File Structure of AOF-RDB Hybrid Method

๐Ÿ“Œ Unlike the previous single file method appendonly.aof, Redis 7.0 creates the following files.

sudo ls -l /var/lib/redis/appendonlydir
-rw-rw---- 1 redis redis  1146587 Feb 19 12:37 appendonly.aof.2.base.rdb   # RDB snapshot file
-rw-r----- 1 redis redis 41279742 Feb 19 20:05 appendonly.aof.2.incr.aof   # AOF delta file (subsequent changes saved)
-rw-r----- 1 redis redis       88 Feb 19 12:37 appendonly.aof.manifest    # AOF-related metadata management file
  • appendonly.aof.X.base.rdb โ†’ A RDB snapshot file storing the current Redis memory state
  • appendonly.aof.X.incr.aof โ†’ An AOF file recording subsequent changes
  • appendonly.aof.manifest โ†’ A metadata file managing the list of AOF files

Redis AOF vs Hybrid Comparison

๐Ÿš€ Conclusion: Since AOF-RDB Hybrid method is the default setting in Redis 7.0 and above, a single appendonly.aof file is not created.


4. Comparison Between Traditional AOF and AOF-RDB Hybrid Method

Comparison Item Traditional AOF (appendonly.aof) AOF-RDB Hybrid (appendonly.aof.X.base.rdb)
File Structure Single appendonly.aof file RDB + AOF Hybrid structure
Recording Method Stores all commands sequentially RDB snapshot + AOF delta storage
Performance Slows down over time Faster and optimized
Recovery Speed on Redis Restart Slow (executes all commands) Fast (loads RDB first, then reflects AOF)
Storage Space Size continuously increases Optimized based on RDB
Disk I/O Burden Increases due to storing all commands Decreased due to RDB basis

๐Ÿ“Œ Conclusion:
- The traditional AOF method has high data reliability, but issues with performance and disk usage.
- The AOF-RDB Hybrid method offers advantages like fast recovery, efficient storage usage, and lower disk I/O burden.
- The AOF-RDB Hybrid method is recommended in most operational environments. ๐Ÿš€


5. Is RDB Configuration Required When Using AOF-RDB Hybrid Method?

๐Ÿ‘‰ Yes, RDB-related settings are necessary!
Since the AOF-RDB Hybrid method is based on RDB, the redis.conf file must have correctly applied RDB-related settings.

โœ… Settings to Check for AOF-RDB Hybrid Method

appendonly yes        # Enable AOF
aof-use-rdb-preamble yes  # Use AOF-RDB Hybrid method (default)
save 900 1 300 10 60 10000  # RDB snapshot creation intervals

๐Ÿšจ If there are no RDB settings, the AOF-RDB Hybrid method may not work properly!
Setting aof-use-rdb-preamble to no will revert to the previous aof single file method.


6. Conclusion: How to Choose Redis AOF Method in Practice

  • In Redis 7.0 and above, AOF-RDB Hybrid method is recommended by default
  • It offers advantages including faster recovery speed, reduced storage space usage, and lower disk I/O burden compared to traditional AOF
  • The hybrid method may not function correctly without RDB settings applied
  • In cases requiring extreme data reliability, like finance or transaction systems, the traditional AOF method may be advantageous

๐Ÿš€ In most operational environments, the AOF-RDB Hybrid method is significantly more efficient than the traditional AOF method and is recommended for use.