简体   繁体   English

kafka中分区比consumer少,如何优化那个consumer group的其他consumer

[英]Less partitions than consumers in kafka, how to Optimize other consumers of that consumer group

Let's assume the scenario where I have four partitions and a consumer group having twenty consumers.让我们假设我有四个分区和一个有 20 个消费者的消费者组的场景。 So only four consumers will be working and sixteen will be in starvation mode.所以只有四个消费者在工作,十六个将处于饥饿模式。 How to optimize that sixteen other consumers so we will have every consumer in working, or how we can optimize this situation?如何优化其他 16 个消费者,让每个消费者都在工作,或者我们如何优化这种情况?

This is desired behaviour.这是理想的行为。 Kafka consumers guarantee that each record in a given partition will be consumed in order; Kafka 消费者保证给定分区中的每条记录都会按顺序消费; if a partition were to have more than one consumer for a given group, this would no longer hold up.如果一个分区对一个给定的组有多个消费者,这将不再成立。

Additionally, consumer groups can keep check of their progress through any given partition on a topic.此外,消费者组可以通过主题上的任何给定分区来检查他们的进度。 If multiple consumers for the same group were competing, recording the offset would become nonsensical.如果同一组的多个消费者在竞争,记录偏移量将变得毫无意义。

I guess you'd want to size your consumer groups when you spin up your application's nodes, but remember that the extra consumers in the group will add resiliency as well (maybe a little more than you bargained for in this case!)我想您会在启动应用程序节点时调整消费者组的大小,但请记住,组中的额外消费者也会增加弹性(在这种情况下,可能比您讨价还价的要多一点!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果消费者比分区更多,kafka消费者如何工作 - How kafka consumer works if consumers are more that partitions Apache Kafka:3个分区,消费组有3个消费者,每个消费者都应该是多线程的 - Apache Kafka: 3 partitions, 3 consumers in the consumer group, each consumer should be multithreaded 如何在消费者组kafka中动态添加消费者 - How to dynamically add consumers in consumer group kafka 使用比分区更多的消费者进行持续的消费者组重新平衡 - Continuous consumer group rebalancing with more consumers than partitions 如何在许多其他消费者使用的 apache kafka 集群中为我的消费者组选择 group.id? - How to pick a group.id for my consumer group in an apache kafka cluster that is used by many other consumers? Kafka如何处理运行速度比其他消费者慢的消费者? - How does Kafka handle a consumer which is running slower than other consumers? 如何在 confluent-kafka-go 中创建具有多个消费者的消费者组? - how to create consumer group with multiple consumers in confluent-kafka-go? 如何在消费者组内对 Kafka 消费者进行负载平衡 - How to load balance Kafka consumers within a consumer group Kafka分区分布在一个消费者组中跨消费者 - Kafka partition distribution across consumers in a consumer group Kafka-node:将消费者添加到消费者组 - Kafka-node: add consumers to consumer group
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM