Share Groups

KIP-932: Queues for Kafka®

Apache Kafka® 4.2 introduces share groups - a significant step towards queue-style consumption.

Guaranteed Ordering → Queue Semantics

Traditional consumer groups use a strict one-to-one binding between consumers and partitions. If a topic has 12 partitions, you can run at most 12 consumers - each exclusively owning its assigned partitions.

KIP-932 (Queues for Kafka®) introduces share groups - a new consumer group type that allows multiple consumers to process records from the same partition concurrently. It is the first new consumer group type in this technology's history.

Share groups make some trade-offs to break this coupling and addresses several long-standing friction points in the Kafka® ecosystem.

Consumer-Partition Decoupling

The number of consumer instances (/compute) is no longer constrained by partition count. If ordering and compute costs are not a concern, this reduces average latency.

Competing Consumers

Kafka® now natively supports the work-queue pattern more typical in RabbitMQ® etc. Tasks can be distributed across a pool of consumer instances.

Consumer Instance Scaling

Consumers can be added or removed without triggering a consumer group rebalance. This makes auto-scaling in response to traffic spikes practical.

Slow Consumer Handling

Consumers can work around a slow instance(s), effectively 'jumping the queue' to reduce head-of-line blocking. If ordering isn't important then this can be acceptable.

Broker-Side State Machine

Share groups introduce per-record state tracking on the broker side. Every record in a share-group subscription passes through a state machine managed by the share-partition leader - the broker that leads the partition for that share group.

States and Acknowledgements

Each record transitions through the following states, moved between them by the consumer's acknowledgement:

Record States

  • Available The record has not been acquired by any consumer. It is eligible for delivery on the next fetch.
  • Acquired A consumer has received the record and holds an acquisition lock. The lock has a configurable timeout - if the consumer fails to acknowledge within this window, the record reverts to Available for redelivery.
  • Acknowledged The consumer has confirmed successful processing. The record will not be redelivered.
  • Archived All records up to the share-partition start offset (SPSO) have been acknowledged. Archived records are eligible for log cleanup.

Acknowledgements

  • ACCEPT - processing succeeded, record should not be redelivered
  • RELEASE - release the lock, make the record available again
  • REJECT - permanent failure, send to dead letter (if configured)
  • RENEW - extend the acquisition lock timeout

Coordination Architecture

Share-partition leader

Each partition in a share group has a designated leader that tracks the in-flight state of every record. It maintains a sliding window between two markers: the Share-Partition Start Offset (SPSO) - below which all records are archived - and the Share-Partition End Offset (SPEO) - above which records have not yet been fetched.

Between SPSO and SPEO sits the active window where records are in various states: Available, Acquired, or Acknowledged. The leader manages this window in memory, serving fetch requests by delivering Available records and tracking which consumer holds each Acquired record.

Share coordinator

State durability is handled by a share coordinator - a new broker role analogous to the existing group coordinator. The coordinator persists record state transitions to an internal topic (__share_group_state), ensuring that state survives broker restarts.

Acknowledgements follow a 3-hop path: consumer to share-partition leader, leader to share coordinator, coordinator to replicas. This is more complex than traditional consumer group offset commits (which are a single write to __consumer_offsets) but necessary for the per-record state tracking that share groups require.

Acknowledgement Modes

Implicit acknowledgement

The default mode. Calling poll() implicitly acknowledges all records returned by the previous poll(). This mirrors the simplicity of traditional consumer group auto-commit and suits workloads where processing is fast and failures are rare.

Explicit acknowledgement

Consumers can acknowledge individual records with fine-grained control.

Deliberate Tradeoffs

Every engineering decision involves trade-offs, so it is important to understand what KIP-932 trades vs. conventional Kafka processing.

1. Ordering no longer Guaranteed

This is the most significant change. The KIP-932 specification explicitly states that share groups do not preserve the ordering semantics that many architectures rely on. Records with the same key may be delivered to different consumers and processed in any order.

For many Kafka uses cases this is the reason the technology was chosen in the first place. Order processing, account state machines, event sourcing, inventory management, and financial transaction streams all depend on messages for the same entity being processed sequentially. Share groups cannot serve these workloads.

The KIP lists per-key ordering as a "potential future KIP" with no timeline or design proposal. It is architecturally difficult: the share-partition leader would need to maintain key-level tracking and enforce acquisition ordering.

2. Increased Broker Overhead

Share groups add per-record state tracking on the broker side. Each record in the active window requires in-memory state, acknowledgement writes go through a 3-hop path, and the __share_group_state internal topic adds I/O and storage. For context on how partition count already drives broker resource consumption, see our analysis of Kafka® partition scaling.

3. Kafka 4.2+ Only

Share groups require broker-side protocol support (new Fetch/Acknowledge RPCs) that only exists in Kafka® 4.2.0 and later. Organisations running earlier versions cannot use share groups without a major version upgrade. Managed services (Confluent® Cloud, Amazon MSK™, Azure® Event Hubs) have their own adoption timelines.

Share groups are also a Kafka® protocol extension. Redpanda™, which implements the Kafka® wire protocol for compatibility, has not announced support for share groups and has no public roadmap to do so. Organisations using Redpanda, or those who may want to evaluate it in the future, cannot depend on share groups as a general solution.

4. More Complex Consuming Applications

Giving up ordering does not remove the need for it. Where a workload does depend on messages for one entity being applied in sequence, that logic moves out of the broker and into the consuming application: sequence numbers, idempotency keys, version checks, or a lock per entity. The partition model did that work for free.

It also changes the economics. Per-key ordering alongside durable replay is a large part of why organisations accept the operational cost of running Kafka at all. A team that has traded ordering for consumer concurrency has given up one of the reasons it chose the technology, and may find that a simpler queueing system such as NATS® meets what is left of the requirement at lower cost.

Per-Key Ordering with Concurrency

A fundamental question for many Kafka® consumers is not "can I have more consumers?" but "can I process messages faster while keeping them in order?" These are different problems with different solutions.

Head-of-Line Blocking

In a traditional consumer group, each partition is processed by a single thread. If partition 3 contains messages for 500 different customer accounts, a slow database write for one customer blocks processing for all 499 others. This is head-of-line blocking, and it is the dominant source of tail latency in consumers.

Share groups partially address this: if a consumer is slow, other consumers pick up available records. But because share groups do not track keys, two consumers may process records for the same customer simultaneously and out of order. For stateful workloads, this is worse than the original problem - you've traded latency for correctness violations.

Client-side demultiplexing

llingr-demux solves the head-of-line blocking problem at the client level by demultiplexing messages across per-key concurrent workers. Messages with different keys are processed concurrently (250 concurrent keys by default, configurable to 5,000 per consumer instance). Messages with the same key are always processed sequentially, maintaining ordering.

The routing is deterministic: an FNV-1a hash of the partition key maps each key to one of 16 worker shards, with each shard managing its own pool of per-key workers under an independent mutex. This means that for 250 concurrent keys processing simultaneously, there is very little contention between messages for different keys.

How llingr-demux Solves This Today

While KIP-932 requires Kafka® 4.2+, broker-side changes, and Java clients, llingr-demux delivers concurrent per-key processing on any broker version, in Go, with zero broker overhead. Here's how:

Deterministic Fan-out

Every message's partition key is hashed with FNV-1a and mapped to one of 16 worker shards via bitwise AND. Each shard maintains its own mutex and worker pool. Messages with the same key always route to the same worker, preserving correctness.

Messages with different keys can then process concurrently through independent worker channels.

Concurrent Workers

Up to 250 keys processed concurrently per consumer instance (configurable to 5,000), each with strict per-key sequential ordering.

A slow message for one key has zero impact on the other 249. p99 tail latencies drop by orders of magnitude because head-of-line blocking is eliminated at the key level, not papered over at the partition level.

Offset Resolution

When per-key workers complete at different speeds, messages can arrive at the offset committer out of partition order.

The committer maintains a high-watermark per partition: contiguous completions advance offset high-watermarks efficiently; out-of-order completions are held in an optimised pre-commit cache until offset gaps fill.

Comparison

The following table compares three approaches to Kafka® consumer concurrency: traditional consumer groups, KIP-932 share groups, and llingr-demux client-side demultiplexing.

Aspect llingr-demux Conventional Consumer KIP-932 Consumer
Partition coupling 100's of per-partition workers 1:1 consumer to partition Any partition → Any consumer
Per-key ordering Yes: concurrent across keys Yes: within partition No
Head-of-line blocking No: per-key workers Yes: single thread per partition Partially solved (no key awareness)
Broker compatibility Any Kafka®, Redpanda™ Any Kafka®, Redpanda™ Kafka® 4.2+ only
Broker overhead Negligible Increases with partition count Significant
Offset tracking Per-partition watermark Per-partition watermark Per-record state machine
Rebalance impact Sub-second coordination Degrades with partition count None (no assignment)

Different Problems, Complementary Solutions

KIP-932 asks: "How can more consumers read from the same partitions?"
llingr-demux asks: "How can one consumer process messages for many keys concurrently while keeping each key in order?"

Both questions are valid, and both have rigorous engineering behind their answers. But they address different layers of the Kafka® consumer architecture:

  • Share groups change the broker-to-consumer delivery model. They can be useful for stateless, unordered workloads where the goal is horizontal fan-out - log aggregation, metrics pipelines, notification dispatch, and data warehouse ingress where sorting can be carried out later.
  • llingr-demux changes the within-consumer processing model. It is designed for stateful, ordered workloads where per-key integrity matters - order processing, account mutations, event sourcing, financial transactions.

If your workload can accommodate queue-style consumers without ordering constraints, then share groups are a viable option. However if you require ordering, it is worth remembering that the KIP-932 design does not currently support this.