Reactive Kafka 和多个分区

huangapple go评论52阅读模式
英文:

Reactive Kafka and many partitions

问题

Kafka分区的数量对于Reactive Kafka接收器是否重要,或者效率是否与一个Kafka分区相同(因为响应式接收器无论如何都只使用一个线程)?

英文:

Does number of Kafka partitions matter for Reactive Kafka Receiver or the efficency is the same as with one Kafka partition (as the reactive receiver anyway uses one thread (if so))?

答案1

得分: 1

根据信息(1234),每个 KafkaReceiver.receive 调用都会在底层创建一个单线程,该线程将执行基本的阻塞 KafkaConsumer.poll() 底层操作。因此,实际上,无论您使用响应式接收器还是原始的Kafka消费者API,您的问题都与基本的Kafka主题管理和配置有关。

有很多关于这方面的文章,这里是Confluent的一个示例。简而言之,通常多个分区会导致更高的性能,但在实际情况中,性能取决于您解决方案的瓶颈在哪里。

英文:

According to sources (1, 2, 3 and 4) each KafkaReceiver.receive call would create single thread under the hood which would execute basic blocking KafkaConsumer.poll() underneath. So it's actually doesn't matter so much whether do you use reactive receiver or raw Kafka consumer API, your question relates to basic Kafka topic management and configuration.

There are plenty articles on it, here is the Confluent's one for example. In a nutshell, usually multiple partitions leads to a higher performance, but in practice it depends on where is the bottleneck of your solution.

huangapple
  • 本文由 发表于 2023年6月4日 23:07:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76401052.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定