Skip to main content
PreparationZone Logo
PrepZone

Redis Persistence: RDB and AOF

Snapshots vs append-only logs — durability trade-offs for in-memory data.

Pass checkpoint below

Why this matters

  • VaultCommerce treats Redis as a cache first — cold restart repopulates from Postgres. Still, session tokens and rate-limit state hurt if wiped unexpectedly.
  • Misconfigured AOF rewrite or RDB saves during peak traffic causes latency spikes on the single command thread.
  • Managed Redis (ElastiCache, Memorystore) hides file paths but you still choose persistence tier and failover behaviour.
StringSessions, counters
ListQueues, feeds
SetUnique tags
Sorted SetLeaderboards
HashUser profiles
StreamEvent log
Each type maps to a common backend pattern.

RDB snapshots

RDB writes the full dataset to a .rdb file on a schedule or after N changes. Restore loads the file back into memory — fast startup, but you lose writes since the last snapshot.

Java
# redis.conf excerpts
save 900 1
save 300 10
save 60 10000
dbfilename dump.rdb
dir /var/lib/redis
Java
BGSAVE
LASTSAVE
INFO persistence | grep rdb

RDB trade-offs

  • Pros — compact files, quick restarts, minimal steady-state overhead.
  • Cons — data loss window equals time since last snapshot.
  • Ops note — BGSAVE forks the process; large datasets mean copy-on-write memory pressure.

VaultCommerce accepts minutes of session loss on a pure cache node and enables RDB every 5 minutes — not every second.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 3 sections

  • AOF append-only file
  • Combining RDB + AOF
  • When persistence is optional

Test yourself

Answer these before moving on — recall is what makes it stick.