Kafka Consumer Lag
IntermediateHow Kafka consumer groups track offsets, how consumer lag accumulates when processing falls behind production, how uneven partition assignment creates lag skew, and how to instrument and remediate consumer lag before it causes data pipeline delays.
Step 1 of 5
Consumer Group: Partition Assignment
Kafka assigns partitions to consumer group members so that each partition is owned by exactly one consumer at a time. With 3 partitions and 3 consumers, each consumer owns 1 partition. With 6 partitions and 3 consumers, each owns 2. The throughput ceiling is bounded by the number of partitions: adding consumers beyond the partition count provides no additional throughput.
Producer
Producer
1,200 msg/s
Topic Partitions
Partition 0
45 msgs
Partition 1
42 msgs
Partition 2
48 msgs
Consumer Groups
order-processor (consumer-0)
order-processor (consumer-1)
order-processor (consumer-2)
3 partitions, 3 consumers: each consumer owns exactly 1 partition
Key Takeaways
- →Partition count is the hard ceiling on consumer parallelism: more consumers than partitions are idle
- →Each partition is owned by exactly one consumer in a group at any time