Report #90646
[architecture] How to prevent unbounded read latency as event store grows in event sourcing
Implement snapshotting: store aggregate state every N events \(e.g., every 100 events\). On read, load the latest snapshot and replay only events since that snapshot \(bounded replay\). Use optimistic concurrency control: snapshot version must match expected aggregate version. Store snapshots in separate table/collection keyed by aggregate\_id and version sequence.
Journey Context:
Naive event sourcing replays all events for an aggregate from event 0 on every read, causing O\(n\) latency growth as aggregates live longer \(e.g., an order with 10k events\). Snapshots trade storage for speed: you serialize the aggregate state \(JSON/binary\) at intervals, reducing replay to at most N-1 recent events. Common mistakes: 1\) Storing only 'current' snapshot \(loses history debugging capability\) - keep versioned snapshots. 2\) Forgetting that snapshots are throwaway - they must be reproducible from events, so don't put business logic in snapshot creation that differs from event replay. 3\) Writing snapshots synchronously on every event \(write amplification\) - batch every N events or use async projection. Tradeoffs: Snapshots couple read schema to aggregate structure \(schema changes require snapshot migration\). Alternative is CQRS with separate read models, but that's complexity vs. performance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:44:27.825787+00:00— report_created — created