Bird
0
0

Given a Kafka topic with 3 partitions and 2 consumers in the same group, how many partitions will each consumer read from?

medium📝 Predict Output Q4 of 15
Kafka - Basics and Event Streaming
Given a Kafka topic with 3 partitions and 2 consumers in the same group, how many partitions will each consumer read from?
AEach consumer reads from all 3 partitions
BOne consumer reads 2 partitions, the other reads 1 partition
CEach consumer reads from 1 partition only
DConsumers cannot share partitions
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kafka consumer group partition assignment

    Kafka assigns partitions evenly among consumers in the same group.
  2. Step 2: Distribute 3 partitions among 2 consumers

    One consumer will get 2 partitions, the other 1 partition.
  3. Final Answer:

    One consumer reads 2 partitions, the other reads 1 partition -> Option B
  4. Quick Check:

    Partition distribution = uneven but balanced D [OK]
Quick Trick: Kafka partitions split evenly among consumers [OK]
Common Mistakes:
  • Assuming all consumers read all partitions
  • Thinking partitions can't be shared
  • Ignoring uneven partition counts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes