← back to stream

Kafka consumer groups

#backend#kafka

A consumer group is a set of consumers that share work on a topic: Kafka assigns each partition to exactly one consumer in the group, and each message is delivered to exactly one consumer. Add more consumers (up to the partition count) and throughput scales; lose one and its partitions are reassigned automatically (rebalance). Multiple consumer groups on the same topic are independent — each group gets its own copy of every message and tracks its own position. This is the core abstraction for "pub/sub" plus "competing consumers" in one model: every team builds their own service consuming the same event stream, but within a team, multiple instances share the load. The thing that bites: partition count caps parallelism — 10 partitions mean at most 10 active consumers in the group; adding an 11th just leaves it idle.