Sobes.tech
Junior — Middle

How does Kafka behave with three partitions and four consumers in a group?

sobes.tech AI

Answer from AI

In Kafka, when there are 3 partitions and 4 consumers in a single group, the following occurs:

  • Each partition can only be assigned to one consumer within the group.
  • Since there are fewer partitions than consumers, one consumer will be left without an assigned partition and, consequently, without data to read.
  • Therefore, 3 consumers will read data from 3 partitions, and the 4th will be idle.

This behavior ensures that each partition is read by only one consumer in the group, guaranteeing message order for each partition.