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

微服务与事件驱动架构

by Adam Bellemare
October 2021
Beginner to intermediate
250 pages
7h 11m
Chinese
Posts & Telecom Press
Content preview from 微服务与事件驱动架构
80
6
水位策略也可以用于再分区事件流。
Apache Samza
提供了一个类似于
Kafka
Streams
的独立模式,不过是使用水位而不是流时间。
6.6
 乱序事件和迟到事件
在理想世界中,所有事件的生产都不存在问题,且无延时地提供给消费者。遗憾的是,我
们都生活在现实世界中,理想情况永远不会存在,所以必须有应对乱序事件的计划。如果
一个事件的时间戳不等于或不大于事件流中位于它前面的事件的时间戳,就被称为是乱序
的。在图
6-7
,事件
F
就是乱序的,因为它的时间戳小于
G
的时间戳;事件
H
也是如此,
它的时间戳小于
I
的时间戳。
(值未展示)
输入事件流分区0
乱序事件
时间
6-7:一个事件流分区中的乱序事件
有边界的数据集,比如进行批处理的历史数据,通常对乱序数据有相当强的弹性。可以把
整个批处理想象成一个大的窗口,如果批处理还没有开始,那么以数分钟甚至数小时偏差
乱序到达的事件就不会有真正的影响。在这种方式下,批处理的有界数据集可以产生高确
定性的结果,但这是以高延迟为代价的,特别是对传统的大数据批处理作业来说,这些作
业的结果在
24
小时后才能使用(加上批处理时间)
对于无边界的数据集,比如那些持续更新的事件流,开发人员在设计微服务时必须考虑延
迟和确定性的要求。这就从技术需求扩展到了业务需求的范畴,所以任何事件驱动型微服
务开发人员都必须问一句:“我的微服务是否要根据业务需求处理乱序和迟到的事件?”
乱序事件要求业务就如何处理它们做出具体决定,并且确定延迟和确定性的优先级。
考虑一下之前银行账户的例子。无论事件的顺序如何排列,也无论事件迟到多久 ...
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