Ephemeral Data vs Persistence
Throwaway state versus durable storage — when to forget and when to remember. A decisive read on the only architecture choice that quietly bankrupts you.
The short answer
Persistence over Ephemeral Data for most cases. Ephemeral data is a performance trick masquerading as an architecture.
- Pick Ephemeral Data if have a true cache, a session token, an in-flight render, or a rate-limit counter — state that is cheaply rebuildable and where losing it costs you nothing but a recompute. Reach for Redis-with-TTL, signed cookies, or process memory
- Pick Persistence if the data answers a question someone will ask later: who paid, what changed, why did it break. That is almost everything. Write it to Postgres, an append-only log, or object storage and sleep
- Also consider: The hybrid that adults actually ship: a durable system of record plus an ephemeral hot layer in front of it. The trap is letting the cache become the only copy — that is how 'ephemeral' silently becomes your unbacked database.
— Nice Pick, opinionated tool recommendations
What they actually are
Ephemeral data is state with an expiry date built into its existence: session caches, in-memory queues, React component state, a Redis key with a TTL, the contents of a serverless function between two HTTP requests. It exists to be fast and forgotten. Persistence is the opposite contract — the data survives the process that created it, the deploy that replaced it, and the engineer who wrote it: Postgres rows, an S3 object, an append-only event log, a file on a disk. These aren't competing products; they're two ends of a durability dial. The dishonest framing is treating them as a stylistic preference. They're not. One is a promise to remember and one is a promise to forget, and confusing which promise you made is how you end up explaining to a customer why their order vanished when a pod restarted.
Where ephemeral earns its keep
Ephemeral data is genuinely the right call when the state is cheaply reconstructable and losing it costs a recompute, not a customer. A cache in front of a slow query: lose it, rebuild it, nobody notices. A session token: re-authenticate. A rate-limit counter: a few requests slip through, the world keeps turning. Streaming-render state, WebSocket connection bookkeeping, a debounce timer — all correctly ephemeral. The win is real: no write amplification, no schema migration, no GDPR deletion request, no backup bill. The discipline is admitting the limit out loud. Ephemeral state must have a documented recovery path, because it will disappear — not might, will, on the next deploy. The failure mode is laziness dressed as minimalism: 'we'll just keep it in memory' becomes the de facto database, and then the load balancer adds a second instance and your users get a coin-flip on whether their data exists.
Where persistence is non-negotiable
Anything that money, law, or a future debugging session touches must be persisted, full stop. Payments, audit trails, user-generated content, model training data, the event that triggered an alert at 3am. The asymmetry is brutal and one-directional: you can downgrade durable data to ephemeral with a retention policy whenever you choose, but you can never retroactively persist a value you threw away. 'We didn't log it' is the most expensive sentence in incident reviews. Persistence costs you upfront — schemas, migrations, backups, a storage bill, deletion compliance — and those costs are visible, which is exactly why lazy teams skip them and pay invisibly later in lost revenue and un-debuggable outages. The honest engineering move is to default to durable and justify every place you chose to forget. If you can't articulate why a piece of data is safe to lose, it isn't, and you're one restart from finding out.
The hybrid most teams should actually ship
The real-world answer is layered, not binary: a durable system of record underneath, an ephemeral hot layer on top. Postgres or an event log holds the truth; Redis, a CDN, or in-process memory holds a fast copy that can vanish without consequence because the truth is elsewhere. Done right, this is the best of both — millisecond reads and zero data loss. Done wrong, it's a time bomb: the cache becomes the only place a write ever landed, and 'ephemeral' silently graduates into your unbacked, un-backed-up production database. The rule that keeps you honest — every write goes to durable storage first, the ephemeral layer is read-optimization only, never write-of-record. If a value can only be found in the cache, you don't have a cache, you have a database with a TTL pointed at your own foot. Pick persistence as the floor and let ephemerality be the speed trim on top.
Quick Comparison
| Factor | Ephemeral Data | Persistence |
|---|---|---|
| Data loss on restart/deploy | Total — state is gone every time, by design | None — survives process, deploy, and the engineer who left |
| Read/write latency | Microseconds; in-memory, no disk, no network | Milliseconds; disk, indexes, durability overhead |
| Auditability and debugging | Nothing to inspect after the fact — the evidence expired | Full record; you can reconstruct what happened and why |
| Operational cost and overhead | Cheap and simple — no backups, schemas, or deletion compliance | Visible costs: storage bill, migrations, backups, GDPR deletes |
| Reversibility of the choice | One-way and unforgiving — you can't un-lose what was never written | Downgrade to ephemeral anytime with a TTL or retention policy |
The Verdict
Use Ephemeral Data if: You have a true cache, a session token, an in-flight render, or a rate-limit counter — state that is cheaply rebuildable and where losing it costs you nothing but a recompute. Reach for Redis-with-TTL, signed cookies, or process memory.
Use Persistence if: The data answers a question someone will ask later: who paid, what changed, why did it break. That is almost everything. Write it to Postgres, an append-only log, or object storage and sleep.
Consider: The hybrid that adults actually ship: a durable system of record plus an ephemeral hot layer in front of it. The trap is letting the cache become the only copy — that is how 'ephemeral' silently becomes your unbacked database.
Ephemeral data is a performance trick masquerading as an architecture. The moment your business cares about what happened — billing, audit, debugging a 3am outage, training a model — you need a durable record, and you needed it before the incident, not after. You can always make persistent data ephemeral with a TTL. You cannot un-lose what you never wrote down. Persistence is the default; ephemerality is the optimization you reach for with evidence, not vibes.
Disagree? nice@nicepick.dev