Skip to Content
Kafka权威指南(第2版)
book

Kafka权威指南(第2版)

by Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty
November 2022
Beginner to intermediate
346 pages
11h
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南(第2版)
292
14
假设我们有一个用户搜索事件流和一个用户点击搜索结果事件流。我们想要匹配用户的搜
索和用户对搜索结果的点击,以便知道哪个搜索的热度更高。很显然,我们需要基于搜索
关键词进行匹配,而且只能匹配一个时间窗口内的事件。假设用户会在输入搜索关键词几
秒之后点击搜索结果。因此,我们为每一个流保留了几秒的时间窗口,并对每个时间窗口
内的事件进行匹配,如图
14-8
所示。
点击
搜索
本地状态
本地状态
5
秒时间窗口
5
秒时间窗口
连接
连接过的事件
14-8:连接两个事件流,总是包含一个移动时间窗口
Streams
支持等价连接(
equi-joins
),流、查询、点击事件都是通过相同的键来进行分区
的,而且这些键就是连接用的键。这样一来,
user_id:42
所有的点击事件都会被保存到点
击主题的分区
5
中,
user_id:42
所有的搜索事件都会被保存到搜索主题的分区
5
中。然
后,
Streams
会确保这两个主题的分区
5
被分配给同一个任务
,这样这个任务就可以看到
所有与
user_id:42
相关的事件。
Streams
在内嵌的
RocksDB
中维护了两个主题的连接时间
窗口,所以能执行连接操作。
14.3.7
 乱序事件
无论是流式处理系统还是传统的
ETL
系统,处理乱序事件对它们来说都是一个挑战。物联
网领域经常出现乱序事件,这也是意料之中的(参见图
14-9
。例如,一个移动设备断开
WiFi
接几小时,在重新连上后将几小时以来累积的事件一起发送出去。这种情况在监控
网络设备时(发生故障的交换机在修复之前不会发送任何诊断数据)或在生产车间(车间 ...
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

时间序列分析实战:基于机器学习和统计学

时间序列分析实战:基于机器学习和统计学

Aileen Nielsen
Spark机器学习实战

Spark机器学习实战

Posts & Telecom Press, Siamak Amirghodsi, Meenakshi Rajendran, Broderick Hall, Shuen Mei
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik
Kubernetes编程

Kubernetes编程

Michael Hausenblas, Stefan Schimanski

Publisher Resources

ISBN: 9787115601421