On this page
Kafka Improvement Proposal
KIP-1226: lag for share groups
KIP-1226 gives share groups a lag number: how many records in a partition the group has not finished with yet. Consumer-group lag, the gap between the end of the log and the committed offset, does not work for share groups because records are acknowledged one by one and out of order. Since Kafka 4.2 the lag shows in kafka-share-groups.sh and the Admin API.
- Proposal
- KIP-1226, Introducing Share Partition Lag Persistence and Retrieval
- Status
- Shipped New in Kafka 4.2 (2026).
- Area
- Consumer groups and queues
- Proposal page
- KIP-1226 on the Apache Kafka wiki
Why it was needed
A share group has a start offset, the SPSO, below which everything is done, but above it records can be acknowledged in any order. Subtracting the start offset from the end of the log overstated the backlog whenever records past a slow one were already done, so operators had no reliable signal of how far behind a queue was.
What it changes
The share-partition leader now counts the records at or above the start offset that are already acknowledged or archived, and persists that count with the share state. Lag is then the records from the start offset to the end of the log minus that count. The group coordinator combines it with the log end offset when you describe the group.
How to use it
- Run kafka-share-groups.sh --describe --offsets: the LAG column shows the lag per partition, or a dash when it is unknown.
- In code, listShareGroupOffsets returns the lag next to the start offset.
Where it stands
Shipped in Kafka 4.2. Compacted-away offsets and transaction control records count as lag until gap acknowledgements archive them, so lag can read a little high on such topics.
What comes next
No follow-up is announced. Lag metrics for share groups in monitoring tools build on this API.
See it in the simulator
- Kafka share group lag: SPSO, SPEO and the acked prefix (SPSO/SPEO/lag: the share-group state machine) Step 4: Acked above a gap - SPSO stuck Open at this step: Kafka share group lag: SPSO, SPEO and the acked prefix
- Kafka share group lag: SPSO, SPEO and the acked prefix (SPSO/SPEO/lag: the share-group state machine) Step 5: Gap filled - SPSO leaps Open at this step: Kafka share group lag: SPSO, SPEO and the acked prefix
The simulator computes lag as the high watermark minus the start offset; Kafka also subtracts the records already acknowledged above the start offset.
Sources
- KIP-1226: Introducing Share Partition Lag Persistence and Retrieval
- Apache Kafka 4.2.0 release announcement