Sobes.tech
Junior — Middle

What is the optimal number of consumers you consider justified for reading data from Kafka?

sobes.tech AI

Answer from AI

The optimal number of consumers in Kafka depends on the number of partitions in the topic, as each partition can only be processed by one consumer from the group at a time.

  • For example, if you have 10 partitions, the maximum number of active consumers in the group is 10.
  • More consumers than partitions will not increase performance, as some consumers will be idle.

Therefore, it is optimal to have a number of consumers equal to the number of partitions or slightly less to ensure a balance between parallelism and efficient resource utilization.