A consumer group is a set of consumers that share the same group.id and cooperate to read a topic. Kafka treats them as one logical subscriber.
The golden rule
Within a group, each partition is assigned to at most one consumer.
So:
- More consumers in the group → more parallel reads (up to the partition count).
- Two groups reading the same topic → each group gets a full independent copy of the stream (each tracks its own offsets).
topic orders (3 partitions) Group "warehouse-loader": consumer A → partition 0 consumer B → partition 1 consumer C → partition 2 Group "fraud-detector": consumer X → partitions 0,1,2 (or split among its members)
Warehouse and fraud both see every order. Inside warehouse, each order partition is handled by only one of A/B/C.
Why this matters
- Scale out processing by adding consumers (until you hit partition count).
- Isolate applications with different
group.idvalues. - Offsets are stored per group per partition (usually in the
__consumer_offsetstopic).
Tiny example
Topic has 6 partitions. Group has 3 consumers → typically 2 partitions each. Add a 4th consumer → partitions rebalance; each gets fewer. Add a 7th consumer → one sits idle (no free partition).
Interview tip: "Same group = load-balanced; different groups = fan-out / broadcast of the same log."