Skip to Content
微服务与事件驱动架构
book

微服务与事件驱动架构

by Adam Bellemare
October 2021
Beginner to intermediate
250 pages
7h 11m
Chinese
Posts & Telecom Press
Content preview from 微服务与事件驱动架构
56
4
非范式化
数据可以根据需要在写入发件箱表之前进行非范式化。
2.
用发件箱表生成事件的缺点
使用发件箱表生成事件也有一些缺点。
需要变更应用程序代码
必须变更应用程序代码以启用该模式,这需要来自应用程序维护者的开发和测试资源。
影响业务处理性能
对业务工作流的性能影响可能非常大,尤其是通过序列化校验
schema
。失败的事务
也会阻止业务操作继续进行。
影响数据存储性能
对数据存储的性能影响可能非常大,尤其是从发件箱表写入、读取和删除大量记录时。
性能影响必须与其他成本保持平衡。例如,一些组织只是简单地解析变更数
据捕获日志来发出事件,而将事后清理工作留给下游团队来处理。这会给下
游团队带来一系列开销,既包括处理和标准化事件的计算成本,也包括解决
不兼容
schema
和处理与内部数据模型强耦合的影响等形式的人力成本
。生
产方节省的成本与消费方处理这些问题所产生的成本相比往往相形见绌。
4.6.4
 使用触发器捕获变更数据
与前文讨论过的审计、二进制日志和预写入日志模式相比,触发器出现得更早。许多较旧
的关系型数据库使用触发器作为生成审计表的方法。顾名思义,触发器被设置为在特定条
件下自动发生。如果失败,那么导致触发器执行的命令也将失败,从而确保更新的原子性。
可以使用
AFTER
触发器捕获行级别的变更到审计表中。例如,执行任何
INSERT
UPDATE
DELETE
命令之后,触发器都会向变更数据表中写入对应的一行数据。这样可以确保对特定
表所做的变更得到相应的跟踪。
考虑图
4-12
所示的例子
。其正在更新插入用户数据到用户表,同时有一个触发器在它们发 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

监控运维实践:原则与策略

监控运维实践:原则与策略

Mike Julian
Kafka权威指南

Kafka权威指南

Neha Narkhede, Gwen Shapira, Todd Palino
Web容量规划之美

Web容量规划之美

Arun Kejariwal, John Allspaw

Publisher Resources

ISBN: 9787115571106