Report #91423
[architecture] Event store read performance degrades as aggregates accumulate thousands of events
Implement versioned snapshots every N events \(e.g., every 100-1000 events\), storing aggregate state plus the version/sequence number of the last included event. Rehydrate by reading the latest snapshot then only events after that version.
Journey Context:
Naive event sourcing replays entire event streams to rebuild aggregates. This works for small streams but fails operationally past 10k\+ events per aggregate due to latency and memory pressure. Simple snapshotting \(saving full state\) breaks when the aggregate schema changes—old snapshots become deserialization hazards. The solution is 'versioned snapshots': save state plus the event version/sequence it represents. On read, grab the latest snapshot, then fetch only events with sequence > snapshot.version. This bounds read complexity to O\(snapshot\_interval\) instead of O\(total\_events\). Alternatives like CQRS read models offload reads but introduce eventual consistency and dual-write complexity. Snapshotting is the fundamental optimization for write-model performance in event sourcing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:02:42.842698+00:00— report_created — created