简体   繁体   English

Kafka中每个主题的一个消费者线程针对多个分区是否会导致延迟?

[英]Does one consumer thread against many partitions per topic in Kafka can cause latency?

Our kafka setup is as follows: 我们的kafka设置如下:

  1. 30 partitions per topic 每个主题30个分区
  2. 1 consumer thread 1个使用者线程

we configured this way to be able to scale-up in the future. 我们将这种方式配置为能够在将来扩大规模。

we wanted to minimize the times we re-balance when we need to scale-up by adding partitions because latency is very important to us and during re-balances messages can be stuck till the coordination phase is done 我们希望通过添加分区来最大程度地减少重新平衡的时间,因为延迟对我们非常重要,并且在重新平衡过程中,消息可能会停留在协调阶段完成之前

Having 1 consumer thread with many partitions per 1 topic can effect somehow the overall messaging consuming latency? 在每个1个主题中拥有1个使用方线程并具有多个分区可以以某种方式影响整体消息传递消耗延迟吗?

More partitions in a Kafka cluster leads to higher throughput however, you need to be aware that the number of partitions has an impact on availability and latency as well. Kafka群集中的更多分区会导致更高的吞吐量,但是,您需要注意分区的数量也会影响可用性和延迟。

In general more partitions, 一般来说,更多分区

  • Lead to Higher Throughput 导致更高的吞吐量
  • Require More Open File Handles 需要更多打开文件句柄
  • May Increase Unavailability 可能会增加可用性
  • May Increase End-to-end Latency 可能会增加端到端延迟
  • May Require More Memory In the Client 客户端可能需要更多内存

You need to study the trade-offs and make sure that you've picked the number of partitions that satisfies your requirements regarding throughput, latency and required resources. 您需要研究折衷方案,并确保已选择满足吞吐量,延迟和所需资源要求的分区数量。

For further details refer to this blog post from Confluent. 有关更多详细信息,请参阅Confluent的此博客文章。

My opinion: Make some tests and write down your findings. 我的意见:做一些测试并写下您的发现。 For example, try to run a single consumer over a topic with 5, 10, 15, ... partitions, measure the impact and pick the configuration that meets your requirements. 例如,尝试在具有5、10、15,...个分区的主题上运行单个使用者,衡量影响并选择满足您要求的配置。 Finally ask yourself if you will ever need x partitions. 最后问问自己是否需要x分区。 At the end of the day, if you need more partitions you should not worry about re-balancing etc. Kafka was designed to be scalable . 归根结底,如果您需要更多的分区,则不必担心重新平衡等问题。Kafka设计为可伸缩的。

暂无
暂无

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

相关问题 每个主题是否可以有一个Kafka使用者线程? - Is it possible to have one Kafka consumer thread per topic? 卡夫卡 - 主题与分区与消费者 - Kafka - Topic & Partitions & Consumer 重新分配 __consumer_offsets 主题的分区会导致问题吗? - Does reassigning partitions of __consumer_offsets topic cause problems? 单个消费者可以从 kafka 主题的多个分区读取吗? - Can single consumer read from multiple partitions of a kafka topic? Kafka 消费者获得特定主题的分配分区 - Kafka Consumer get assigned partitions for a specific topic 在 Kafka 中,如果客户端改变了一个主题的分区,它会创建一个新的主题吗? 它会导致重新平衡吗? - In Kafka, If a client alters the partitions of a topic, Would it create a new topic? Does it cause rebalancing? Kafka使用者 - 消费者进程和线程与主题分区的关系是什么 - Kafka consumer - what's the relation of consumer processes and threads with topic partitions 一个 Kafka 主题中的分区可以具有不同的复制因子吗? - Can partitions in one Kafka topic have different replication factors? 一个 kafka 主题可以处理多少个消费者群体? - how many consumer groups can a kafka topic handle? 如何使用多个工作人员(相同数量的分区)扩展同一主题上的 kafka 消费者应用程序 - How to scale kafka consumer applications on the same topic with more than one worker (the same number of partitions)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM