confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Multithreaded consumption kafka

Open cxin-william opened this issue 2 years ago • 1 comments

Is there a demo of multithreading consumption in Kafka? The order requirements are not high, just need to improve consumption efficiency on the line。 thanks

cxin-william avatar Mar 14 '22 03:03 cxin-william

Hi @cxin-william, thanks for asking.

The first method to improve consumption rate issimply adding more consumers in the same group. However, that approach is more suitable for horizontal scaling where you add new consumers by adding new application nodes (containers, VMs, and even bare metal instances).

If the improvement from the above method is not enough for you, there are many ways to do multi-threaded consumer model please refer to : https://www.confluent.io/blog/kafka-consumer-multi-threaded-messaging/ (It's for java client, but I think we still can use the method for python client).

jliunyu avatar Mar 16 '22 00:03 jliunyu