Skip to content
BENIBIX Learn

Kafka Consumer Group

Also known as Consumer Group, Consumer Group Lag

Readers that split a topic's partitions between them. Each group reads on its own.

Think of it like

It is like a team sharing a pile of letters. Each person takes their own stack. No letter is read twice.

Example

The orders topic has 6 partitions. The billing group runs 3 readers, so each one reads 2 partitions.

Why it matters

Groups let you add readers to go faster. They also let many teams read the same topic without getting in each other's way.

Definition

A Kafka consumer group is a set of readers that share the work of one topic. Each partition is read by just one member of the group at a time. If a member stops, its partitions are handed to the others. A second group reads the same topic on its own, with its own offsets. Lag is how far a group is behind the newest event.

Example code

console
$ kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
    --describe --group billing
Show each partition the billing group reads, its offset and its lag.
A topic is split into partitions. Each consumer in a group reads its own, and remembers its place.

Common mistake

Running more readers than partitions. Each partition goes to just one reader. So the extra readers sit idle.

Key takeaways

  1. 1
    Share the work. Partitions are split among members.
  2. 2
    One reader per partition. Within one group.
  3. 3
    Groups are separate. Each keeps its own offsets.