kafka 应用程序的多个消费者可以在同一个线程上工作吗?
Can multiple consumers of kafka application work on the same thread?
在来自 the Confluent site 的下图中,我们可以看到多个消费者任务可以在同一个线程上工作。我的问题是,如果一个应用程序由多个消费者组成(可以从不同的主题读取),是否会发生其中一些消费者在单个线程上工作的情况。
我问这个是因为我也 read 那:
You can’t have multiple consumers that belong to the same group in one thread (...)
这表明,一般来说,消费者可以共享一个线程,如果我们试图将同一个组设置为来自单个应用程序的多个消费者,它有时可能无法工作。我确实观察到了与之匹配的行为:当我为所有应用程序消费者设置相同的组时,只有一部分有效。
第二个问题是为什么当我将 num.stream.threads 设置为大于消费者数量的数字时它没有帮助。
can it happen that some of those consumers would work on a single thread
没有。 Kafka Streams 基于 num.stream.threads
配置创建线程,并将为每个线程创建一个 KafkaConsumer
。
The second question is why when I set num.stream.threads to a number greater to the number of consumers it didn't help.
"great to the number of consumers" 是什么意思?没有 "number-of-consumer" 配置。
在来自 the Confluent site 的下图中,我们可以看到多个消费者任务可以在同一个线程上工作。我的问题是,如果一个应用程序由多个消费者组成(可以从不同的主题读取),是否会发生其中一些消费者在单个线程上工作的情况。
我问这个是因为我也 read 那:
You can’t have multiple consumers that belong to the same group in one thread (...)
这表明,一般来说,消费者可以共享一个线程,如果我们试图将同一个组设置为来自单个应用程序的多个消费者,它有时可能无法工作。我确实观察到了与之匹配的行为:当我为所有应用程序消费者设置相同的组时,只有一部分有效。
第二个问题是为什么当我将 num.stream.threads 设置为大于消费者数量的数字时它没有帮助。
can it happen that some of those consumers would work on a single thread
没有。 Kafka Streams 基于 num.stream.threads
配置创建线程,并将为每个线程创建一个 KafkaConsumer
。
The second question is why when I set num.stream.threads to a number greater to the number of consumers it didn't help.
"great to the number of consumers" 是什么意思?没有 "number-of-consumer" 配置。