Sobes.tech
Middle+

If there are 3 partitions and 2 consumers — will we not receive messages from one partition?

sobes.tech AI

Answer from AI

In Kafka, with 3 partitions and 2 consumers in the same group, each partition can only be assigned to one consumer. This means one of the partitions will remain unassigned to any consumer, and messages from it will not be consumed until a third consumer appears or a rebalancing occurs.

Example:

  • Partitions: P0, P1, P2
  • Consumers: C1, C2

The assignment could be: C1 → P0, P1; C2 → P2, or another distribution, but one partition will always be "without a partner." To process all partitions, there must be at least as many consumers as partitions.