Snapshot Support for Performance #248
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Slipstream/eventcore#248
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Optimize state reconstruction for long-lived streams by periodically saving snapshots and starting reconstruction from snapshot instead of version 0.
Depends on: #247 (Performance Benchmarking Suite) - need performance data to determine if snapshots are necessary and what snapshot frequency makes sense.
Design
SnapshotStore Trait
save_snapshot(stream_id, version, state)methodload_snapshot(stream_id)returns(version, state)Executor Integration
Benchmark-Driven
Acceptance Criteria
Migrated from beads issue: eventcore-012
Benchmark-gated decision: defer to 1.1.0.
This issue's first acceptance criterion is to review benchmark data to determine whether snapshots are needed. Running
cargo bench -p eventcore-bench --bench execute -- execute/single_stream/warm(command execution with state reconstruction, in-memory store, on streams pre-seeded with N events) gives:Reconstruction is dominated by fixed per-execute overhead through ~1000 events; the marginal per-event cost is only ~3-5 µs. State reconstruction therefore only becomes a bottleneck at tens of thousands of events in a single stream.
EventCore's multi-stream / dynamic-consistency-boundary design discourages giant single-aggregate streams, and the DB-read / peak-memory dimensions are already addressed by batch INSERTs (#360/#362), single-serialization (#361), and streaming reads (#364, ADR-0049). Snapshots would add substantial complexity — a
SnapshotStoretrait, per-command-state serialization, read-after-version support onEventStore, and opt-in executor wiring — for a cost that is not yet a demonstrated bottleneck.Decision: defer to the 1.1.0 milestone. Revisit when real-world profiling identifies long-lived streams (10k+ events) as an actual performance problem; at that point the read-after-version capability would build naturally on the streaming-read API introduced in #364.