← All Articles

Event Sourcing Snapshot Cadence and Replay Costs

A cost model for snapshot frequency in event-sourced systems, balancing write overhead against replay latency and incident recovery speed.

Snapshots are a classic tradeoff: write amplification now versus replay pain later.

Simple Cost Frame

Let replay time be $R(n)$ for $n$ events since snapshot, and snapshot overhead per write be $S$. Pick cadence minimizing expected recovery + steady-state costs.

Practical Heuristic

  • Snapshot on both count threshold and wall-clock threshold.
  • Snapshot sooner for aggregates with high recovery criticality.
if events_since_snapshot > 10_000 or age > 30m => snapshot

Tune cadence using incident replay data, not gut feel.

Next ArticleZero-Trust Service Identity with SPIFFE in KubernetesSecurity · 15 min read