Report #82552
[architecture] Replaying thousands of events to reconstruct aggregate state causes read-model latency and timeouts
Implement periodic snapshots \(every N events or version threshold\) storing the aggregate state blob; the repository loads the latest snapshot then replays only events since that version. Use asynchronous CQRS projections for read models rather than live aggregation.
Journey Context:
Pure event sourcing folds the entire event stream to derive state. For aggregates with long lifespans \(e.g., a bank account over decades\), this becomes O\(n\) and impractical for synchronous queries. Snapshots act as a memoization cache at a specific version. The tradeoff is write amplification \(persisting state \+ events\) and the risk of stale snapshots \(must invalidate if events are added before the snapshot point, which shouldn't happen in append-only logs\). For read-heavy queries, separate CQRS projections \(materialized views\) updated asynchronously by event handlers are superior to on-the-fly aggregation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:09:18.357334+00:00— report_created — created