Monedula
Kafka guide contents

Markdown

Part VI · Reference

Kafka Improvement Proposal

KIP-1226: lag for share groups

Consumer groups and queues · Shipped · since Kafka 4.2 · status checked November 2026

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
Acked above a gap - SPSO stuck. The key lesson. We acked 0,1 (SPSO advanced to 2) then 3,4 - but deliberately NOT 2. Even though 3 and 4 are acked, SPSO stays at 2: it only advances over the CONTIGUOUS acked prefix, so an acked record above an in-flight gap stays inside the lag window (lag 3, not 1). Open this step in the full playground

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

The simulator computes lag as the high watermark minus the start offset; Kafka also subtracts the records already acknowledged above the start offset.

Sources

All Kafka KIPs