Report #59900
[architecture] Event-sourced aggregate reconstruction timeout due to unbounded event stream
Implement snapshotting every N events \(e.g., 100-1000\) storing aggregate state as a serialized blob. Load only the latest snapshot plus events occurring after its version to reconstruct state.
Journey Context:
Teams new to event sourcing often load the entire event stream for an aggregate. This works until popular aggregates accumulate millions of events, causing OOM errors, timeouts, and slow command processing. Snapshotting introduces complexity: snapshots are derived data \(can be rebuilt from events\) but must be versioned with the event schema. Store snapshots in a separate table/collection keyed by aggregate ID and version. The tradeoff: write amplification \(every N events requires an extra write\) and the risk of snapshot corruption \(mitigated by only trusting events for truth\). EventStoreDB and Axon provide built-in snapshotting; DIY solutions must handle concurrency \(optimistic locking on snapshot version\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:01:40.972768+00:00— report_created — created