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

微服务与事件驱动架构

by Adam Bellemare
October 2021
Beginner to intermediate
250 pages
7h 11m
Chinese
Posts & Telecom Press
Content preview from 微服务与事件驱动架构
具有确定性的流处理
81
对单个分区中的事件来说,无论其时间戳是多少,总是根据它们的偏移量顺
序来进行处理。这就会导致乱序事件。
只有从消费者微服务的视角来看,一个事件才能被认为是
迟到
的。一个微服务可能认为所
有乱序事件都是迟到的,而另一个微服务可能很宽容,需要经过几小时的挂钟时间或事件
时间之后才认为事件是“迟到”的。
6.6.1
 使用水位和流时间的迟到事件
假设有两个事件,一个事件的时间是
t
(将该事件称为事件
t
),另一个事件的时间是
t'
(将
该事件称为事件
t'
)。事件
t'
有比事件
t
更早的时间戳。
水位
事件
t'
在水位
W
(
t
)
之后到达会被认为是迟到的。如何处理此事件取决于具体的节点。
流时间
如果事件
t'
在流时间之后到达,而流时间已经递增超过了
t'
,则
t'
会被认为是迟到的。
如何处理此事件取决于拓扑中的每个操作。
一个事件只有在晚于某个消费者指定的截止时间到达时才是迟到的。
6.6.2
 乱序事件的原因和影响
乱序事件有几种发生方式。
1.
来源于乱序数据
当然,最明显的是当事件来源于乱序数据时。这种情况会发生在从已经乱序的流中消费数
据时或当事件正来自存在乱序时间戳的外部系统时。
2.
多个生产者写到多个分区
多个生产者向多个输出分区写数据会导致乱序事件。对一个现有的事件流再分区是乱序
事件发生的一种方式。图
6-8
展示了两个消费者实例对两个分区进行再分区的情况
。在
这个场景中,源事件表明用户与哪个产品发生了交互。例如,
Harry
已经跟
ID
12
ID
77
的产品发生了交互
。假设有一位数据分析师需要重新设置这些数据的键为用户 ...
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