知识卡片
快照加速事件重放
快照缓存某个事件版本的状态。加载时先取快照,再读取该版本之后的事件补放,得到当前状态;事件存储仍是真源。先基准测试聚合预期生命周期的重放成本,确有瓶颈再加快照,并检查聚合边界是否过大。书中的事件数量经验值不能替代本系统测量。
结构图:
flowchart TD
A[读取版本为v的快照] --> C[应用v之后的事件]
B[读取v之后的事件] --> C
C --> D[当前聚合状态]
相关:[[事件溯源保存变化历史]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 建模时间维度 · 查看原书依据
In the rare cases when projecting states does become a performance issue, another pattern can be implemented: snapshot. This pattern, shown in Figure 7-2, implements the following steps: A process continuously iterates new events in the event store, generates corresponding projections, and stores them in a cache. An in-memory projection is needed to execute an
参考来源
- 位置:《Learning Domain-Driven Design》第7章《建模时间维度》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch07.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:In the rare cases when projecting states does become a performance issue, another pattern can be implemented: snapshot. This pattern, shown in Figure 7-2, implements the following steps: A process continuously iterates new events in the event store, generates corresponding projections, and stores them in a cache. An in-memory projection is needed to execute an