---
title: "KIP-1226 explained: lag for Kafka share groups"
description: "KIP-1226 in plain words: how Kafka 4.2 measures how far behind a share group is, why consumer lag does not work for queues, and where the lag column shows up."
url: https://monedula.dev/kafka/kips/kip-1226/
---

# 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.

## At a glance

- 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](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1226%3A+Introducing+Share+Partition+Lag+Persistence+and+Retrieval)

## 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](https://monedula.dev/kafka-simulator/scenarios/spso-speo-lag/) (SPSO/SPEO/lag: the share-group state machine), step 4: 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 at this step](https://monedula.dev/kafka-simulator/playground/?scenario=22.1.9&t=3)
- [Kafka share group lag: SPSO, SPEO and the acked prefix](https://monedula.dev/kafka-simulator/scenarios/spso-speo-lag/) (SPSO/SPEO/lag: the share-group state machine), step 5: Gap filled - SPSO leaps. Acking offset 2 fills the gap - the whole run 0..4 is now contiguous-acked, so SPSO leaps straight to 5 and lag collapses to 0. SPSO is the durable 'everything below here is done' marker the share-group coordinator persists. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=22.1.9&t=4)

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](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1226%3A+Introducing+Share+Partition+Lag+Persistence+and+Retrieval)
- [Apache Kafka 4.2.0 release announcement](https://kafka.apache.org/blog/2026/02/17/apache-kafka-4.2.0-release-announcement/)

## Related KIPs

- [KIP-932 explained: Queues for Kafka and share groups](https://monedula.dev/kafka/kips/kip-932/)
- [KIP-1222 explained: renewing a share group record lock](https://monedula.dev/kafka/kips/kip-1222/)
