Databases & System Design•Part 4: In-Memory Caching & Fast Data Stores (Redis) (41 - 50)
Redis Persistence: RDB vs AOF:
In Simple Words:
- RDB: Point-in-time binary snapshots. Fast restarts, but risks losing recent minutes of data.
- AOF: Append-only log of every write command. High durability, but larger file size. Production standard: Combine both.
ini
# Production persistence settings in redis.conf:
save 900 1 ; Snapshot if 1 key changed in 15 mins
appendonly yes ; Enable AOF
appendfsync everysec ; Flush WAL log to disk every 1 second