Database / REDIS
What is RDB persistence in Redis?
RDB (Redis Database) persistence works by taking a point-in-time snapshot of the entire in-memory dataset and writing it to a single compact binary file on disk, either on a configured schedule or on demand. Because it's a full snapshot rather than a running log, restarting from an RDB file is fast — Redis just loads one file back into memory.
# redis.conf save 900 1 # snapshot if at least 1 key changed in 900 seconds save 300 10 # snapshot if at least 10 keys changed in 300 seconds
BGSAVE # trigger a snapshot in the background, non-blocking
The trade-off is the gap between snapshots: any writes that happened after the last successful snapshot are lost if Redis crashes before the next one completes, so RDB alone offers weaker durability than a continuously-appended log. BGSAVE forks a child process to write the snapshot so the main Redis process keeps serving requests during the save, but that fork itself briefly duplicates memory pages (via copy-on-write), which is a real operational consideration on memory-constrained instances with very large datasets.
More Related questions...
