# RDB Snapshots vs AOF Logs — Redis

Source: https://www.geekswithgeeks.com/en/redis/redis-persistence

> How Redis survives a restart even though it lives in RAM.

## RDB: point-in-time snapshots

**RDB** periodically dumps the whole dataset to a compact binary file on disk. Fast to restore, but any writes since the last snapshot are lost on a crash.

## AOF: append-only log

**AOF** logs every write command as it happens. It can be replayed to rebuild state exactly, losing at most a second of writes — safer, but the log grows larger and replay is slower.

## Use both together

Most production setups enable both: RDB for fast full backups, AOF for minimal data loss between them.
