Consumer groups
- Identify partition assignment, group offsets and the bottleneck in a hot partition.
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- P0, P1 and P2 are partitions of orders. F1 and F2 divide those partitions for fulfillment. A1 reads all three for analytics.
- A group commit saves its next offset per partition. For P0, end 103 means records run through 102. Fulfillment at 98 can read 98–102.
- A rebalance changes the assignment. If F2 leaves, F1 can take P1 and resume at fulfillment’s saved offset 60.
Reading
- Analytics at 101 has two P0 records left in this example. If fulfillment stalls on P0, analytics can continue.
- A fourth fulfillment worker gets no partition while three workers already own the three partitions.
Consumer groups and topic subscriptions
Consumer groups and topic subscriptions
Apache Kafka 4.1 · illustrative cluster and offsets
Stable assignment in a classic consumer group
- Each subscribed partition has one assigned member per group in this example. Fulfillment assigns P0/P2 to F1 and P1 to F2. Analytics independently assigns all three to A1.
- The coordinator manages group membership and commits. Group offsets are persisted in the internal __consumer_offsets topic. The record bytes remain in the user topic under its retention policy.
- Consumers fetch from brokers and track their next local position. A durable commit records the next offset from which that group can resume.
Two group assignments and their committed offsetsjson
{
"topic": "orders",
"assumptions": ["stable classic consumer groups", "one topic subscription", "uncompacted partitions", "contiguous user records", "all records visible"],
"partitions": [{"id":0,"endExclusive":103},{"id":1,"endExclusive":61},{"id":2,"endExclusive":201}],
"groups": {
"fulfillment": {
"assignment": {"F1":[0,2],"F2":[1]},
"committedNext": [98,60,201],
"lagInOffsets": [5,1,0]
},
"analytics": {
"assignment": {"A1":[0,1,2]},
"committedNext": [101,61,195],
"lagInOffsets": [2,0,6]
}
},
"rebalance": {"group":"fulfillment","removed":"F2","stableAssignmentAfter":{"F1":[0,1,2]},"resumePartition1At":60}
}
Measure the partition that dominates lag
| Partition | End exclusive | Fulfillment committed next | Offset distance |
|---|---|---|---|
| P0 | 103 | 98 | 5 |
| P1 | 61 | 60 | 1 |
| P2 | 201 | 201 | 0 |
- Under the fixture assumptions fulfillment has six records remaining. Analytics has eight. The two groups can progress and replay independently.
- For read_committed consumers, open transactions can hold the visible end behind the high watermark. Compaction gaps, aborted records and control records break the one-offset-per-visible-business-record assumption. Fetch position can advance beyond the group commit.
Rebalance and capacity
- If F2 leaves, F1 can receive P1 after assignment stabilizes. Starting from its last committed next offset of 60 can repeat work whose effect completed before the commit.
- A fourth fulfillment member adds no partition ownership with only three partitions. A single hot key can saturate one partition while others remain idle.
- Processing preserves per-partition order only when the application also orders its effects. Parallel offload requires tracking completed prefixes before committing the next offset.
- Retained history sets the replay window. If a group falls behind the log start offset, it needs its configured offset-reset or an explicit recovery decision.