Redis RDB vs AOF: Persistence Trade-offs at Scale
Redis RDB vs AOF: which persistence mode fits a high-throughput SaaS? Compare fork latency, data-loss risk, and recovery time before you decide.
Redis RDB vs AOF: which persistence mode fits a high-throughput SaaS? Compare fork latency, data-loss risk, and recovery time before you decide.
"Redis RDB vs AOF" is one of the most searched Redis questions for a reason: the default answer that worked for a 2GB cache falls apart once you're pushing tens of thousands of writes per second through a multi-tenant SaaS. The short answer is that RDB is cheap until it forks, AOF is safe until it fsyncs, and most production systems at scale should run a hybrid of both rather than picking one. This post walks through why, with the numbers that actually matter when you're sizing persistence for sustained load.
RDB (Redis Database) is a point-in-time snapshot. On a schedule, Redis forks a child process, and that child walks the in-memory dataset and writes a compact binary file to disk while the parent keeps serving traffic. AOF (Append Only File) is a write log: every command that mutates data gets appended to a file, and Redis replays that log on restart to rebuild state. RDB answers "what did the data look like a few minutes ago?" AOF answers "what is the complete, ordered history of writes?" Those are different guarantees, and they fail differently under load.
On a quiet dataset, RDB's fork is nearly free. Under sustained high write throughput it isn't. Linux uses copy-on-write for the forked child, so every write your primary process makes after the fork duplicates the touched memory pages. On a large, write-heavy keyspace (say 20GB+ with a high mutation rate), that copy-on-write churn can double memory usage temporarily and introduce latency spikes of tens to hundreds of milliseconds while the fork completes — precisely when you can least afford them.
AOF's cost shows up differently, through the appendfsync setting. With appendfsync always, Redis calls fsync after every write, which is the safest option and also the slowest — throughput can drop 50-80% depending on disk speed, which is why AOF-heavy deployments should run on NVMe or provisioned-IOPS storage, not burstable network volumes. appendfsync everysec batches the fsync to once per second and is the practical default for most teams: you risk losing up to one second of writes on a hard crash, but throughput overhead stays low. appendfsync no defers to the OS entirely, which is fast but reintroduces unpredictable data-loss windows tied to kernel flush behavior, not your application.
| Dimension | RDB | AOF (everysec) |
|---|---|---|
| Write latency impact | Near-zero, except during fork on large/hot datasets | Small, consistent overhead per write batch |
| Data-loss window on crash | Since the last snapshot (minutes) | Up to ~1 second |
| Recovery speed on restart | Fast — loads a compact binary file | Slower on very large logs unless AOF rewrite has run recently |
| Disk I/O pattern | Bursty (snapshot intervals) | Continuous append + periodic rewrite |
| Memory overhead | Temporary spike from copy-on-write during fork | Minimal |
| Best fit | Cache-only or replica-backed data | Sessions, queues, anything you can't regenerate |
This is a recovery-point-objective conversation, not just a Redis config choice. If Redis is purely a cache in front of PostgreSQL or MySQL, losing the last few minutes of writes on crash is a non-event — the cache just warms up again from the source of truth, and you may not need persistence at all. If Redis is your session store, a queue backend (BullMQ, Laravel Horizon jobs waiting to run), or a rate-limiter with business consequences, a few minutes of silently vanished writes means logged-out users, dropped jobs, or a rate limit that resets and lets an abuser through. Map each Redis-backed feature to "can this data be regenerated cheaply?" before you pick a persistence strategy — the answer is rarely the same across every use case sharing one Redis instance.
Teams size persistence around data-loss risk and forget about recovery time, which is just as operationally important under load. RDB files load fast because they're already in Redis's native binary format. A large pure-AOF log, especially one that hasn't had a rewrite in a while, can take minutes to replay on startup — and during that replay, that node is not serving traffic. In a failover scenario where a replica is being promoted under production load, minutes of unavailability is the difference between a blip and an incident. This is the strongest argument for AOF rewrite scheduling (auto-aof-rewrite-percentage) and for testing actual restart times against your real dataset size, not a synthetic benchmark.
Redis has supported RDB-preamble AOF since version 4, and it's the sensible default for most serious production workloads today: set aof-use-rdb-preamble yes, and Redis writes AOF rewrites as a compact RDB snapshot followed by the incremental commands since that snapshot. You get RDB's fast load time and AOF's tight data-loss window in one file. Pair that with appendfsync everysec, save intervals tuned to your write volume for the RDB side, and replicas that can serve reads (and take over) if the primary's fork or fsync ever causes a latency spike you can't tolerate on that node alone.
“Persistence settings are a promise about what you're willing to lose and how long you're willing to be down. Most incidents we've seen trace back to a promise the team never actually decided on — they just kept Redis's defaults.”
This post covers persistence in isolation — pair it with our guide to scaling Redis end-to-end as traffic grows, from sharding to hot-key mitigation.
Read: Scaling Redis for High-Traffic SaaSA load test tells you Redis can handle your write volume. It doesn't tell you what happens when that fork's copy-on-write spike lands during your traffic peak, or how long your replica takes to come back online after a forced restart with a three-year-old AOF file that's never been rewritten. Persistence decisions are cheap to get right up front — a few lines in redis.conf and a restart-time test — and expensive to discover wrong during an incident, when the dataset is bigger, the traffic is higher, and everyone is watching the dashboard.
RDB has negligible impact during normal operation and only causes latency spikes during the fork on large, write-heavy datasets. AOF with appendfsync everysec adds a small, steady overhead per write batch that's acceptable for almost all workloads; appendfsync always can cut throughput by 50-80% depending on disk speed.
Yes, and it's a valid choice if Redis is purely a cache sitting in front of a durable database like PostgreSQL or MySQL. Just make sure every key can be cheaply regenerated on a cold restart, and that your application handles an empty cache gracefully rather than stampeding the origin database.
It depends on log size and whether a hybrid RDB-preamble rewrite has run recently. A large, un-rewritten pure AOF log can take minutes to replay; a hybrid AOF file with a recent RDB preamble loads close to RDB speed. Always test replay time against a production-sized dataset before you rely on it during a failover.
Use AOF, since queue entries are usually not regenerable if lost. appendfsync everysec is the right default for most job queues; move to appendfsync always only for jobs where losing up to a second of writes has direct financial or compliance consequences.
No. Persistence protects against a process restart or crash on a single node; it does not protect against disk failure, a bad deployment, or a region outage. Pair persistence with cross-AZ replication and, for critical data, periodic RDB snapshot exports to durable storage like S3.
Sizing Redis persistence, replication, or a broader caching strategy for a growing SaaS? Fepiq's team designs and hardens Redis architecture for production workloads.
Talk to FepiqOccasional, no-fluff notes on shipping modern software — startups, automation, Laravel, Shopify and more. No spam, unsubscribe anytime.
Keep reading
Redis eviction policy explained: how maxmemory-policy works under sustained load, which of 8 options to pick, and how to avoid silent data loss in production.
How to scale Redis under sustained load: eviction policies, hot keys, AOF vs RDS persistence, and clustering explained for growing SaaS teams.
Let's build something
Book a free discovery call. We'll listen, ask sharp questions, and send you a proposal within 3 business days.