Need a little help regarding Kafka partition assignment

Hello, I’m preparing for the CCDAK exam and got stuck on one of the practice questions. So,

There are two consumers C1 and C2 belonging to the same group G subscribed to topics T1 and T2. Each of the topics has 3 partitions. How will the partitions be assigned to consumers with Partition Assigner being Round Robin Assigner?

A) C1 will be assigned partitions 0 and 2 from T1 and partition 1 from T2. C2 will have partition 1 from T1 and partitions 0 and 2 from T2.

B) Two consumers cannot read from two topics at the same time

C) C1 will be assigned partitions 0 and 1 from T1 and T2, C2 will be assigned partition 2 from T1 and T2.

D) All consumers will read from all partitions

Could someone please explain which one is the correct answer and why?

Hello @jameswilson, I recently passed the exam. This practice question is quite similar to one of the sample exam questions that I got from study4exam for my exam preparation. The Round Robin Partitioner assignment strategy assigns partitions to consumers in a round-robin manner, ensuring an even distribution of partitions across consumers.

As per the given scenario, there are 2 consumers (C1, C2) in the same consumer group (G). They are subscribed to two topics (T1, T2). Each topic has 3 partitions, so there are a total of 6 partitions to assign (T1: p0, p1, p2; T2: p0, p1, p2). The Round Robin Assignment is:

  1. C1 gets T1-p0
  2. C2 gets T1-p1
  3. C1 gets T1-p2
  4. C2 gets T2-p0
  5. C1 gets T2-p1
  6. C2 gets T2-p2

So the distribution would be:

  • C1: T1-p0, T1-p2, T2-p1
  • C2: T1-p1, T2-p0, T2-p2

All of this matches the description in option A making it the correct option.

The other options are incorrect because:

  • B is incorrect because two consumers can indeed read from multiple topics at the same time.
  • C is incorrect because the Round Robin Assigner doesn’t group partitions by topic.
  • D is incorrect because each partition can only be assigned to one consumer within the same group.
1 Like

Thanks @DavidMc for explaining everything. It’s a huge help. All is clear now.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.