Skip to Content
Kafka权威指南
book

Kafka权威指南

by Neha Narkhede, Gwen Shapira, Todd Palino
January 2018
Beginner to intermediate
234 pages
7h 8m
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南
52
4
参数,以及如何根据实际需要来配置这些参数。
心跳行为在最近版本中的变化
0.10.1
版本里,
Kafka
社区引入了一个独立的心跳线程,可以在轮询消息的空档发
送心跳。这样一来,发送心跳的频率(也就是消费者群组用于检测发生崩溃的消费者
或不再发送心跳的消费者的时间)与消息轮询的频率(由处理消息所花费的时间来确
定)之间就是相互独立的。在新版本的
Kafka
里,可以指定消费者在离开群组并触发
再均衡之前可以有多长时间不进行消息轮询,这样可以避免出现
活锁
livelock
),
如有时候应用程序并没有崩溃,只是由于某些原因导致无法正常运行。这个配置与
session.timeout.ms
是相互独立的,后者用于控制检测消费者发生崩溃的时间和停止
发送心跳的时间。
本章的剩余部分将会讨论使用旧版本
Kafka
会面临的一些问题,以及如何解决这些问
题。本章还包括如何应对需要较长时间来处理消息的情况的讨论,这些与
0.10.1
或更
高版本的
Kafka
没有太大关系。如果你使用的是较新版本的
Kafka
,并且需要处理耗
费较长时间的消息,只需要加大
max.poll.interval.ms
的值来增加轮询间隔的时长。
分配分区是怎样的一个过程
当消费者要加入群组时,它会向群组协调器发送一个
JoinGroup
请求。第一
个加入群组的消费者将成为“群主”。群主从协调器那里获得群组的成员列
表(列表中包含了所有最近发送过心跳的消费者,它们被认为是活跃的),
并负责给每一个消费者分配分区。它使用一个实现了
PartitionAssignor ...
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

精通機器學習

精通機器學習

Aurélien Géron
精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9787115473271