---
title: "How Kafka Finally Solved the “One Slow Message Blocks Everything” Problem — Share Groups, Explained Simply"
author: "Amit Verma"
date: 2026-09-25
updated: 2026-09-25
topic: "Messaging & Real-time"
format: "Deep dive"
canonical: https://realproblem.me/blog/kafka-share-groups-queues
description: "Why one slow message blocks a Kafka partition, how teams worked around it, and how share groups (KIP-932) let many consumers read and ack one partition."
---

# How Kafka Finally Solved the “One Slow Message Blocks Everything” Problem — Share Groups, Explained Simply

*For 15 years one consumer owned each partition. Share groups change that.*

*[Diagram: Left: in a consumer group one consumer owns the partition and a single stuck record blocks everything behind it while other consumers sit idle. Right: in a share group several consumers pull records from the same partition and the stuck record blocks only itself.]*

You have a Kafka topic called `image-jobs` with 6 partitions. Every message says "make thumbnails for this upload." On a normal day, 6 consumers process the load. Then a marketing campaign starts, uploads rise 10×, and lag starts to climb. So you do the obvious thing. You scale the consumer deployment from 6 pods to 30. Lag still climbs. Twenty-four of your new pods run, stay healthy and stay connected to Kafka — and they process *nothing*. One partition made no progress for four minutes. The message at the front of that partition is a 400 MB TIFF, and the resize takes minutes. Nothing behind that message moves until the resize finishes.

Both problems have one cause. The workers you cannot use and the one message that freezes everything behind it come from the same design decision at the heart of Kafka. **A partition belongs to exactly one consumer in a group, and progress on that partition is a single number.** That rule makes Kafka very good for ordered event streams. It is also the reason that, for fifteen years, teams who wanted a plain *work queue* had two options. They forced Kafka into a shape it was not built for, or they ran RabbitMQ or SQS next to it.

Kafka 4.2 (February 2026) ships the fix as production-ready: **share groups**, from KIP-932, "Queues for Kafka." This post tells the story in order: **the problem**, **how we solved it earlier**, and **how Kafka solves it now**. It then compares earlier and now, problem by problem. It ends with the code, the settings, and the guarantees you give up when you change.

*[Diagram: The story of this post in three steps: the problem, the earlier fixes, and the new solution with share groups.]*

## The feel: supermarket lanes vs. the bank line

Think of a **supermarket**. Each checkout lane has one cashier. Each customer selects a lane and stays in it. This works until the customer at the front of lane 3 needs a price check. Lane 3 now stops. The people behind that customer cannot move to another lane. The cashiers in lanes 1, 2 and 4 may have nobody to serve. More cashiers do not help either. A new cashier with no lane of their own has no work.

Now think of a **bank**. There is one line, and each teller who becomes free calls "next." If one customer needs twenty minutes, that teller is busy. Everyone else continues through the other tellers. Add a teller, and the line moves faster immediately.

A classic Kafka **consumer group** is the supermarket. Partitions are lanes, consumers are cashiers, and each lane has exactly one cashier. A **share group** makes each partition a bank line. Many consumers can take the next available record from the same partition, and a slow record occupies only the one consumer that processes it.

Consumer groups give you order, because each partition has one owner. Share groups give you throughput, because any free worker can take the next record. You cannot have both at full strength, so Kafka now lets you choose.

Part 1The problemWhy adding workers stops helping, and why one message can freeze a partition

## How a classic consumer group works

Two rules explain almost everything about the old model.

**Rule 1: one partition, one consumer.** When consumers join a group, the group divides the topic's partitions between them. Each partition goes to exactly one member. With 6 partitions and 4 consumers, two consumers get two partitions each. With 6 partitions and 8 consumers, **two consumers get nothing at all**. They join, they send heartbeats, and they stay idle as hot spares.

**Rule 2: progress is a single offset per partition.** Records in a partition are numbered 0, 1, 2, 3… (the *offset*). The consumer group does not remember which records it processed. It remembers one number per partition, the committed offset. That number means "everything below this is done." If you commit `105`, you state that offsets 0 to 104 are all complete.

*[Diagram: A topic with four partitions and a consumer group with six consumers. Four consumers each own one partition; consumers five and six are assigned nothing and stay idle.]*

This design is not a mistake. It gives you two things that are hard to get any other way:

-   **Ordering per key.** All events for `user-42` hash to the same partition, and one consumer reads that partition in order. The group always processes "account opened" before "account closed."
-   **Small, cheap progress tracking.** The group stores one integer per partition, even at millions of records per second. To replay, move the number back.

For event streams, CDC pipelines and stream processing, that is the right trade. The trouble starts when the messages are not events in a story. They are **independent jobs**: send this email, resize this image, call this webhook, run this report. Jobs do not need order. They need any free worker to complete them.

## Problem 1: the parallelism ceiling

Because of Rule 1, **the number of consumers that can do useful work equals the number of partitions**. Six partitions give you six workers. Partition count is a storage decision you made months ago, and that decision now sets a hard limit on how fast you process work today.

The usual answer is "just create more partitions." It works, but every option has a cost:

-   **Partitions are not free.** Every partition adds log segment files, index files and open file handles on every replica. Every partition also needs a leader election and replication traffic. Many teams created 200 partitions "for headroom" on a topic that needed 12 for its data.
-   **You can add partitions but never remove them.** If you over-provision for a Black Friday peak, you carry those partitions forever.
-   **More partitions move keys.** The default partitioner selects a partition with `hash(key) % numPartitions`. If you change the count, `user-42` goes to a different partition. The per-key ordering you depend on breaks at that moment.
-   **You must predict the peak in advance.** Autoscaling consumers is easy. Autoscaling partitions is not practical.

**What about KIP-848?** Kafka 4.0 also made the new consumer rebalance protocol (KIP-848) generally available. It makes rebalances incremental and much less disruptive, which is a big improvement. It does not change Rule 1. A partition still has at most one owner in a consumer group. The limit is the same. You only reach it more smoothly.

## Problem 2: head-of-line blocking, in depth

**Head-of-line blocking** is a general name for one idea. The item at the front of a line is stuck, so everything behind it is stuck too. This includes items that another worker could have handled immediately. The same term appears in networking, where one lost TCP packet delays every HTTP/2 stream behind it. It also appears in CPU pipelines and in switch buffers. In Kafka it comes directly from Rule 2.

Follow the sequence slowly. Your consumer polls a batch of offsets 100 to 110. Offset 101 is the 400 MB TIFF. The other ten records are small JPEGs that need 50 ms each.

*[Diagram: Offsets 100 to 110 in one partition. Offset 100 is done, offset 101 is stuck processing, and offsets 102 to 110 could be finished but the committed offset cannot move past 101, so on a crash all of them are redelivered.]*

The standard poll loop processes one record at a time, so records 102 to 110 simply wait. Lag on that partition grows. No other consumer can help, because no other consumer may read partition 0.

You can answer: "I will process the batch in parallel threads inside my consumer." Records 102 to 110 now finish in a few hundred milliseconds. You still cannot *commit* them. You can commit only a single offset, and a commit of 111 would mean "101 is done too." That leaves two bad options. Commit early and **lose 101** if you crash, or hold the commit and **process 102–110 again** if you crash. You must also track which offsets finished, and control your polls so that memory does not grow while 101 continues.

Production makes this worse. Head-of-line blocking reaches you on call in four forms:

-   **The slow message.** One job needs minutes instead of milliseconds. Everything behind it in that partition waits. Your graph shows lag on *one* partition that climbs while the other partitions stay near zero.
-   **The rebalance loop.** One poll of records can need more time than `max.poll.interval.ms` (5 minutes by default). The group then treats your consumer as dead and moves its partitions to another member. The new owner starts from the last committed offset, which is still 101. It receives the same slow message, and the group removes it for the same reason. Your whole group then spends its time in rebalances.
-   **The poison pill.** A malformed message makes your handler throw an exception every time. If you retry without a limit, the partition stops permanently. If your process crashes, it restarts, reads the same message from the committed offset, and crashes again. One bad record disables a part of your pipeline.
-   **The unreliable dependency.** The webhook for one customer times out after 30 seconds, every time. Every job for every other customer in that partition waits behind it.

**The key point:** in a consumer group, you cannot say "skip this record now and return to it later." There is no per-record state. There is a line and a pointer. Every workaround that teams built is a way to *simulate* per-record state on a system that does not have it.

Part 2How we solved it earlierFive workarounds teams built on top of Kafka — and the bill each one left

## The earlier fixes: five workarounds (and why each one hurt)

Teams did not accept the problem. For about fifteen years, teams that ran job queues on Kafka built their own fixes. Almost every production Kafka setup uses one or more of these five fixes. Each fix works, and each fix leaves a bill.

### Fix 1: "Just add more partitions"

This is the first fix everyone tries. Change 6 partitions to 60, run 60 consumers, and each lane becomes shorter. Throughput does improve. The costs are the ones above: broker overhead, no way to reduce the count later, and keys that move to new partitions. This fix also **does not remove head-of-line blocking**. It only makes each lane shorter. A stuck record still freezes everything behind it in its partition. The blast radius is now 1/60th of the topic instead of 1/6th.

### Fix 2: "Catch it, log it, move on"

```java
for (ConsumerRecord<String, String> record : records) {
    try {
        makeThumbnails(record.value());
    } catch (Exception e) {
        log.error("failed, skipping offset {}", record.offset(), e);   // 🙈
    }
}
consumer.commitSync();   // the failed job is now "done" forever
```

This keeps the partition in motion, and a lot of production code does it quietly. The price is **silent data loss**. A failed job counts as processed, and the only evidence that it existed is a log line nobody reads. This is acceptable for a view counter. It is not acceptable for "charge this customer" or "send this password reset email."

### Fix 3: Retry topics and a dead-letter topic

This is the mature version. Uber's engineering blog made it popular in 2018, and Spring Kafka includes it as `@RetryableTopic`. When a job fails, you do not retry it in place. You **publish a copy to a retry topic**, commit the original, and continue. A separate consumer reads the retry topic after a delay and tries the job again. After a few failed rounds, the record goes to a dead-letter topic (DLQ) for a human to examine.

*[Diagram: Retry topic pattern: a failed job from the main topic is copied to retry topic 1 with a 1 minute delay, then retry topic 2 with a 10 minute delay, then a dead-letter topic. Each topic needs its own consumer.]*

```java
// Spring Kafka hides the plumbing, but the topics are still real
@RetryableTopic(attempts = "4", backoff = @Backoff(delay = 1000, multiplier = 2.0))
@KafkaListener(topics = "image-jobs")
public void handle(String job) {
    makeThumbnails(job);            // throw ⇒ Spring re-publishes to a retry topic
}

@DltHandler
public void deadLetter(String job) {
    alerting.notify("thumbnail job gave up: " + job);
}
```

**The clever trick inside this pattern.** Why one topic for each delay, instead of one retry topic? A Kafka consumer can wait only for the record at the front. If every record in `jobs-retry-1` has the same 1-minute delay, the records are already sorted by "time to run." The consumer waits for the front record, and it never blocks a record that is due sooner. If you mix delays in one topic, you build head-of-line blocking into your retry system.

What it costs:

-   **Topic sprawl.** Every job type needs its own retry and DLQ topics, consumers, alerts and permissions. Multiply that by every team.
-   **Your handler becomes a producer.** "Publish to retry, then commit the original" is two steps. If you crash between the two steps, you lose the job or you retry it twice.
-   **You lose order anyway.** A retried job runs minutes after the jobs that followed it.
-   **The DLQ becomes a graveyard.** Someone must build tools to inspect and replay it. Usually nobody does.
-   **It does not help slow jobs.** Retry topics handle *failures*. A slow job that succeeds still blocks its partition.

### Fix 4: Process in parallel inside the consumer

If one consumer owns the partition, make that one consumer process many records at the same time. Confluent's open-source **Parallel Consumer** library is the best-known version. It reads a partition with a normal consumer, runs records on many threads, and tracks which offsets finished out of order.

```java
ParallelConsumerOptions<String, String> options = ParallelConsumerOptions.<String, String>builder()
        .ordering(ProcessingOrder.UNORDERED)   // or KEY: parallel across keys, ordered within a key
        .maxConcurrency(100)                   // 100 jobs in flight from one consumer
        .consumer(kafkaConsumer)
        .build();

ParallelStreamProcessor<String, String> processor =
        ParallelStreamProcessor.createEosStreamProcessor(options);
processor.subscribe(List.of("image-jobs"));
processor.poll(ctx -> makeThumbnails(ctx.getSingleConsumerRecord().value()));
```

How does it avoid the single-offset rule? It still commits the lowest safe offset, 101 in this example. It also writes a compressed list of the offsets after 101 that are already done into the **commit metadata** string. After a restart, it reads that list and skips the finished records. The result is per-record state inside a field that was designed for a short note.

What it costs:

-   **One owner per partition remains.** You scale threads inside a pod, not pods. Your 24 idle pods are still idle. You gave 6 pods 100 threads each.
-   **A limit on how far ahead it can work.** Commit metadata has a size limit. A large enough gap behind a stuck record still forces the library to slow down.
-   **A library, not the platform.** It supports Java only, it is another dependency to understand, and all the state lives in the client. The broker does not see any of this, so the normal tools cannot show you which jobs are in flight.

### Fix 5: Put a real queue next to Kafka

Many teams gave the honest answer: "Kafka is not a queue, so let's use a queue." Events go to Kafka. Jobs go to RabbitMQ or Amazon SQS. A bridge service or a Kafka Connect sink sometimes copies them across. SQS has exactly the features that Kafka lacked. Any worker takes any message. A *visibility timeout* hides a message while a worker processes it. A `maxReceiveCount` redrive policy sends repeated failures to a DLQ.

The cost is **a second system** to run, secure, monitor, pay for and support on call. You copy data between the two systems. A job can therefore be lost in two places, and you compare two sets of metrics at 3 AM. You also lose the original attraction of Kafka: a job queue you can replay from the log.

**What all five fixes have in common:** each one tracks the state of *individual messages* outside the broker, because the broker could not do it. Retry topics store that state as extra copies of messages. The Parallel Consumer stores it in commit metadata. SQS stores it in a different product. **Share groups move that state into Kafka itself.**

Part 3The new solution: share groupsWhat Kafka built, when it shipped, and how it works inside the broker

## When and why share groups arrived

The Kafka community proposed KIP-932, **"Queues for Kafka,"** in 2023 with a clear goal. Kafka must give you the semantics of a work queue **on the same durable, replayable log**. Any free consumer takes the next message. The consumer acknowledges each message on its own. Kafka retries a failure a limited number of times. You need no second system, and you copy no data. The topic does not change at all. A share group is only a different way to read it.

| Release | Date | Status of share groups |
| --- | --- | --- |
| Kafka 4.0 | March 2025 | **Early access.** Not for production. You could not upgrade a cluster that used it. |
| Kafka 4.1 | September 2025 | **Preview.** Rewritten and not compatible with 4.0 early access. You enable it with a feature flag. |
| Kafka 4.2 | February 2026 | **Production-ready.** Adds the RENEW acknowledgement (KIP-1222), share-group lag metrics (KIP-1226) and a configurable acquire mode (KIP-1206). |
| Kafka 4.3 | May 2026 | Per-group overrides for delivery limit and in-flight window (KIP-1240). |
| Next | — | Built-in dead-letter queues (KIP-1191) are accepted and in development, but **not in any release as of 4.3.1**. |

## How share groups work

A share group looks like a consumer group from the outside. Consumers use a `group.id`, subscribe to topics, and poll. Two things are fundamentally different.

**1\. Many consumers can read the same partition.** The broker assigns partitions with the built-in `simple` assignor, and it may give one partition to several members. You can run 30 consumers against a 6-partition topic, and all 30 get work. A broker setting limits the member count (`group.share.max.size`, 200 by default). Your partition count does not.

**2\. The broker tracks every in-flight record.** The broker keeps a small state machine for each record it delivered, in place of one committed offset per partition. When a consumer fetches, the broker gives it a batch of records. The broker marks those records **Acquired** by that consumer and sets a time-limited lock (30 seconds by default). No other consumer gets those records while the lock holds. The consumer then acknowledges each record on its own.

*[Diagram: Share group record state machine. Available records become Acquired when fetched, which increments the delivery count. Acquired records become Acknowledged on ACCEPT, go back to Available on RELEASE or lock timeout if under the delivery limit, and become Archived on REJECT or when the delivery limit is reached. RENEW keeps a record Acquired and extends its lock.]*

Look at what this state machine gives you, compared with the old list of problems:

-   **Slow record?** It stays Acquired by one consumer. The records behind it stay Available, and the broker gives them to other consumers. Nobody waits in line.
-   **Consumer crashed during a job?** Its lock expires, the record returns to Available, and another consumer takes it. The whole group does not rebalance for that.
-   **Transient failure?** The consumer acknowledges with `RELEASE`, and the record returns to Available immediately for another attempt.
-   **Poison pill?** Every delivery increments a counter. When the counter reaches `group.share.delivery.count.limit` (default 5), the broker archives the record instead of delivering it again. The poison pill costs five attempts, not your pipeline. Your code can also detect the problem immediately and send `REJECT`.

### The in-flight window: how the broker keeps this cheap

A broker cannot track state for every record in a topic that holds billions of records. The trick is that the broker tracks only a **window** of records per partition: the records that are in play now. KIP-932 calls this a *share-partition*. Two offsets bound it:

-   **SPSO (Share-Partition Start Offset):** everything below this is finished (acknowledged or archived). It behaves like the old committed offset.
-   **SPEO (Share-Partition End Offset):** the broker has not delivered anything at or above this offset yet.

Only the records between the two offsets carry per-record state. When every record at the start of the window reaches a terminal state, SPSO moves forward. `group.share.partition.max.record.locks` limits the window size (2,000 by default in 4.2). When that many records are in flight on a partition, the broker delivers no more records until some of them finish.

*[Diagram: A share-partition window between SPSO and SPEO. Inside the window, records have mixed states: acknowledged, acquired by different consumers, available again, and archived. Records below SPSO are finished and records at or above SPEO have not been delivered yet.]*

SPSO is still stuck at 100 because of the slow record. The start of the window still cannot pass an unfinished record. The difference is that **this no longer limits throughput**. Other consumers process and acknowledge records 101 to 107. The slow record holds back only the start of the window. It becomes a problem only if thousands of records accumulate behind it and the window fills. That failure is much softer than "the whole partition stops."

## Inside the cluster: where the state lives

Per-record state must survive broker restarts and leader changes. If it does not, a failover delivers everything in flight again. Kafka divides the work between two server components.

*[Diagram: Share group architecture. Consumers send ShareGroupHeartbeat to the group coordinator for assignment, and ShareFetch and ShareAcknowledge to the partition leader. The partition leader keeps the in-memory share-partition state and persists changes through the share coordinator into the internal topic __share_group_state.]*

-   **The group coordinator** handles membership. Consumers send `ShareGroupHeartbeat` requests, and the coordinator returns their assignment. Share groups use only this new heartbeat protocol, which is built on the same foundation as KIP-848.
-   **The partition leader** does the main work. It holds each share-partition's window in memory. It answers `ShareFetch` requests and acquires records for the caller. It applies acknowledgements. A consumer can send acknowledgements with the next `ShareFetch`, which needs no extra round trip. It can also send them on their own with `ShareAcknowledge`.
-   **The share coordinator** makes the state durable. When the window changes, the leader writes it with `WriteShareGroupState` to the internal topic `__share_group_state`. It writes a full `ShareSnapshot` at intervals and smaller `ShareUpdate` records between the snapshots. This is the same snapshot-plus-delta design as a database write-ahead log. After a failover, the new leader calls `ReadShareGroupState` and continues with the same window.

**Why the broker keeps state per batch, not per message.** The broker acquires and tracks records in batches where it can. It splits a batch only when records in that batch reach different states. This keeps the bookkeeping cost close to the cost of a normal fetch. It is also the reason that Kafka 4.2 added `share.acquire.mode`. The default `batch_optimized` follows batch boundaries and may return more records than `max.poll.records`. `record_limit` respects that limit exactly.

Part 4Earlier vs. now, problem by problemEvery old problem, the old fix, and what the broker does for you today

## The big picture: who does the work

The whole change fits in one picture. Earlier, **your application** carried the bookkeeping: extra partitions, thread pools, offset tracking, retry producers, and retry and dead-letter topics. Some teams ran a whole second messaging system instead. Now **the broker** carries the bookkeeping, and the workers become simple again.

*[Diagram: Before and after. Before: the application does the bookkeeping with 200 partitions, a thread pool, an offset tracker, a retry producer, retry and dead-letter topics, or a bridge to RabbitMQ or SQS. After: the topic keeps 6 partitions, the broker tracks locks, delivery counts and per-record acknowledgements, and 30 simple workers just poll, work and acknowledge.]*

## Problem by problem

Each card below reads left to right: the problem, how we fixed it earlier, and what share groups do now.

*[Diagram: Problem: two partitions mean only two consumers get work and the rest sit idle. Earlier fix: add many partitions or threads inside one pod. Now: many consumers share one partition.]*

*[Diagram: Problem: a slow message at the front makes everything behind it wait. Earlier fix: process in parallel threads but the committed offset stays stuck. Now: the slow message is locked to one worker and the others keep moving.]*

*[Diagram: Problem: retrying forever blocks the partition and skipping loses data. Earlier fix: copy the message through retry topics to a dead-letter topic. Now: RELEASE puts the message back and the broker counts the attempt.]*

*[Diagram: Problem: a bad message crashes the consumer, which restarts and reads the same message again, forever. Earlier fix: a dead-letter topic plus your own alerts. Now: after five delivery attempts the message is archived.]*

*[Diagram: Problem: the whole group rebalances and work since the last commit is replayed. Earlier fix: tune timeouts, make handlers idempotent, accept replays. Now: the lock expires and only that worker's messages go back for another worker.]*

*[Diagram: Problem: Kafka had no per-message acknowledgements, retries or locks. Earlier fix: run RabbitMQ or SQS beside Kafka and copy data across. Now: one topic is read by a consumer group and a share group side by side.]*

**If you know SQS, you already know share groups.** The acquisition lock is the visibility timeout (both default to 30 seconds). The delivery count limit is `maxReceiveCount`. `ACCEPT` is `DeleteMessage`. `RELEASE` is setting the visibility timeout to zero. `RENEW` is `ChangeMessageVisibility`. The difference is that the messages still live in a Kafka log. Kafka retains them, you can replay them, and ordinary consumer groups can read them at the same time.

In one sentence: before, Kafka only remembered *where each group was* in a partition. Now it can also remember *what happened to each message*.

Part 5Using it for realThe code, the settings, what you give up, and when to pick which

## The code

### Turning it on

The `share.version` feature controls share groups. A new Kafka 4.2+ cluster enables it by default. On an upgraded cluster, and on 4.1 where it is a preview, all brokers must run the new version first. Then you enable the feature:

```bash
bin/kafka-features.sh --bootstrap-server localhost:9092 \
  upgrade --feature share.version=1
```

**Small test clusters:** the internal `__share_group_state` topic defaults to replication factor 3 with `min.isr` 2. On a dev cluster with 1 or 2 brokers, first set `share.coordinator.state.topic.replication.factor` and `share.coordinator.state.topic.min.isr` to 1. If you do not, share groups do not work.

### A worker with explicit acknowledgements

The client is `KafkaShareConsumer`. It looks almost like a normal consumer on purpose. It has no `assign()` and no `seek()`, because the broker decides which consumer gets which records.

```java
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "thumbnail-workers");             // this is now a SHARE group
props.put("key.deserializer", StringDeserializer.class.getName());
props.put("value.deserializer", StringDeserializer.class.getName());
props.put("share.acknowledgement.mode", "explicit");    // default is "implicit"

try (KafkaShareConsumer<String, String> consumer = new KafkaShareConsumer<>(props)) {
    consumer.subscribe(List.of("image-jobs"));

    while (running) {
        ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(500));

        for (ConsumerRecord<String, String> record : records) {
            try {
                makeThumbnails(record.value());
                consumer.acknowledge(record, AcknowledgeType.ACCEPT);   // done
            } catch (TransientException e) {
                consumer.acknowledge(record, AcknowledgeType.RELEASE);  // try again, maybe elsewhere
            } catch (BadInputException e) {
                consumer.acknowledge(record, AcknowledgeType.REJECT);   // never retry this one
            }
        }

        // Send the acks now and see per-partition results.
        // Without this, acks are sent with the next poll().
        Map<TopicIdPartition, Optional<KafkaException>> result = consumer.commitSync();
    }
}
```

Four details of this loop matter:

-   **Implicit and explicit mode.** In the default `implicit` mode you never call `acknowledge`. A second call to `poll()`, `commitSync` or `commitAsync` accepts every record from the previous poll. That is the simplest migration from a normal consumer. In `explicit` mode you acknowledge each record yourself. Acknowledge every record from one poll before you call `poll()` again.
-   **The client batches acknowledgements.** `acknowledge()` records your decision locally. The decision reaches the broker on the next `poll()`, `commitSync()` or `commitAsync()`. If you use `commitAsync`, register `setAcknowledgementCommitCallback` to learn whether the broker received the acknowledgements.
-   **You can see how many times the broker delivered a record.** Records from a share consumer carry a delivery count, so a handler can log or send an alert on attempt 4 of 5.
-   **Long jobs: RENEW.** A job may need more time than the lock allows (30 s by default). Acknowledge that job with `AcknowledgeType.RENEW` and commit, to extend the lock while you continue. Send `ACCEPT` when you finish. Before 4.2, the only option was a longer lock duration for the whole group.

### Operating a share group

```bash
# Who is in the group, and how far along is each partition?
bin/kafka-share-groups.sh --bootstrap-server localhost:9092 \
  --describe --group thumbnail-workers              # --members, --offsets, --state

# A brand-new share group starts at the END of the topic by default.
# To process what's already there, change the group config:
bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter \
  --entity-type groups --entity-name thumbnail-workers \
  --add-config share.auto.offset.reset=earliest

# Rewind (the group must have no active members)
bin/kafka-share-groups.sh --bootstrap-server localhost:9092 \
  --reset-offsets --group thumbnail-workers --topic image-jobs \
  --to-earliest --execute
```

**The first mistake everyone makes.** `share.auto.offset.reset` defaults to `latest`. If you start a new share group on a topic that already holds a million jobs, you process *none* of them. You process only the jobs produced after the group started. This is a **group config**, set with `kafka-configs`, not a client property. A normal consumer works differently.

### The settings that matter (Kafka 4.2 defaults)

| Setting | Where | Default | What it controls |
| --- | --- | --- | --- |
| `group.share.record.lock.duration.ms` | broker | 30000 | How long a consumer holds a record before the broker gives it to another consumer. Per-group override: `share.record.lock.duration.ms`. |
| `group.share.delivery.count.limit` | broker | 5 (range 2–10) | Attempts before the broker archives a record. Per-group override from 4.3: `share.delivery.count.limit`. |
| `group.share.partition.max.record.locks` | broker | 2000 | Size limit of the in-flight window per partition. Per-group override from 4.3. |
| `group.share.max.size` | broker | 200 | Max members in one share group. |
| `share.auto.offset.reset` | group | `latest` | Where a new group starts: `latest`, `earliest` or `by_duration:<ISO-8601>`. |
| `share.isolation.level` | group | `read_uncommitted` | Set `read_committed` to skip aborted transactional records. |
| `share.acknowledgement.mode` | consumer | `implicit` | Auto-accept on next poll vs. per-record acks. |
| `share.acquire.mode` | consumer | `batch_optimized` | Align with batches, or strictly respect `max.poll.records` (`record_limit`). |

## What you give up

Share groups are not "consumer groups, but better." They are a different deal, and you should know exactly what you trade away.

-   **No ordering guarantee.** The broker gives records from one partition to many consumers, and they finish in any order. A released record returns *after* the records that were behind it. Records inside a single delivered batch arrive in offset order, but across the partition there is no promise. If your system must process `order-created` before `order-shipped`, a share group is the wrong tool.
-   **At-least-once, and only at-least-once.** A lock can expire while your handler still works. Another consumer then gets the same record, and you process it twice. Share groups do not support exactly-once or transactional consumption. **Handlers must be idempotent**: an idempotency key, an upsert, or a "processed" table. The [exactly-once post](https://realproblem.me/blog/myth-of-exactly-once-delivery) explains why this was always true anyway.
-   **Lock duration is a real trade-off.** A short lock duplicates slow jobs. A long lock keeps a crashed consumer's records locked until the timer expires. Measure your p99 job time and set the lock above it. For long jobs, use RENEW.
-   **Archived is not a dead-letter queue yet.** After the delivery limit, the broker marks the record Archived and skips it. The record stays in the topic log. Nothing tells you about it, and nothing moves it to a place you can inspect. Built-in DLQ support (KIP-1191) is accepted but not released as of 4.3.1. Until it ships, publish a failed job that matters to your own error topic from the handler, before you `REJECT` it.
-   **No per-key state and no stream processing.** Kafka Streams, joins and windowed aggregations need a classic consumer group. Any design that assumes one consumer sees all records for a key needs one.
-   **No manual control.** No `assign()`, no `seek()`, no static membership. You can reset a group's start point with the CLI, but a consumer cannot move to another position in the log on its own.
-   **The window can still fill.** A stuck record at the start holds SPSO back. If 2,000 records accumulate behind it, the partition delivers no new work until the lock expires. Head-of-line blocking is *much* softer, but it is not gone.
-   **It is new.** Share groups are production-ready since February 2026, and 4.2.1 contains an important deadlock fix. Lag metrics exist from 4.2 only. Run the latest patch release. Check that your client libraries support share groups, not only the Java client, before you plan around them.

## Which one should you use?

| Your workload | Use | Why |
| --- | --- | --- |
| Events that tell a story per key (orders, accounts, CDC) | Consumer group | Per-key ordering is the whole point |
| Stream processing, joins, aggregations | Consumer group / Kafka Streams | Needs all records for a key in one place |
| Independent jobs: emails, thumbnails, webhooks, reports | Share group | Scale workers freely. Slow jobs do not block fast ones |
| Jobs with very uneven processing times | Share group | This is exactly the head-of-line problem it solves |
| Need delayed delivery, priorities, per-message TTL today | SQS / RabbitMQ | Share groups do not offer these features |

Remember also that you do not have to choose per topic. **A consumer group and a share group can read the same topic at the same time.** Your analytics pipeline reads `image-jobs` in order with a consumer group. At the same time, 30 thumbnail workers process it as a queue with a share group. One copy of the data, two ways to read it.

**Share group**

-   Consumers can outnumber partitions — scale workers, not partitions.
-   A slow or failing record only blocks itself.
-   Built-in retry with a delivery limit. The broker archives poison pills.
-   A crashed worker's records return after the lock expires.
-   No second messaging system to run.

**What it costs**

-   No ordering across the partition.
-   At-least-once only. Duplicates are normal, not rare.
-   No built-in DLQ yet. Archived records are silent.
-   You must tune the lock duration to your job times.
-   New: fewer client libraries and less production history.

## The takeaway

For fifteen years, Kafka had one way to read a topic. That way was built for ordered streams: one owner per partition, one number for progress. For that reason, extra consumers stopped helping after the partition count. For the same reason, one slow or broken message could freeze everything behind it. Three points are worth carrying away:

1.  **Head-of-line blocking comes from the way the system tracks progress.** If progress is a single pointer, the pointer can move only past records that are finished. The slowest record at the front then sets the pace. Parallel threads do not fix that. Per-record state does.
2.  **Order and parallelism work against each other.** A consumer group selects order. A share group selects parallelism. Decide what your data needs. Jobs rarely need order. Events usually need it.
3.  **Queue semantics mean at-least-once.** Any worker can take any record, and locks can expire, so duplicates are part of normal operation. Make every handler idempotent before you change. Plan how you handle archived records until built-in DLQs ship.

You may run a job queue on Kafka today with 200 partitions "for headroom," with retry topics you wrote yourself, or with a RabbitMQ cluster that exists only because Kafka could not be a queue. If so, test it on 4.2. Point a share group at the existing topic. Keep your consumer group running next to it. Then watch 30 workers finally do the work of 30 workers.

**Further reading.** KIP-932 "Queues for Kafka" on the Apache Kafka wiki holds the full design, including the record state machine and share-partition persistence. The Kafka 4.2 release announcement and upgrade notes cover production readiness, KIP-1222 RENEW, KIP-1226 lag metrics and KIP-1206 acquire mode. KIP-1240 adds per-group share configs in 4.3. KIP-1191 adds dead-letter queues for share groups and is in progress. The `kafka-share-groups.sh` section of the Kafka operations docs covers the CLI. Related posts here: [the myth of exactly-once delivery](https://realproblem.me/blog/myth-of-exactly-once-delivery) (why idempotent handlers are non-negotiable), [backpressure and flow control](https://realproblem.me/blog/backpressure-flow-control) (what the in-flight window really does), and [long-tail latency](https://realproblem.me/blog/long-tail-latency-and-popularity) (why one slow item dominates a queue).

---

Originally published at https://realproblem.me/blog/kafka-share-groups-queues by Real Problem.
