When should a team run a Kafka workload on a share group instead of a consumer group or a separate queue broker, and what does adopting share groups cost?
answer
- order, keyed state, exactly-once
- independent jobs, elastic workers
- share.version and 4.2
- new client, new tooling
basics
~20 sUse a share group for independent jobs that need more workers than partitions or per-record retry; keep a consumer group for ordering, keyed state or exactly-once; and budget a 4.2+ cluster, share.version, a client rewrite and new tooling.
solid answer
~40 sI start from what the workload needs. Ordering, keyed state or exactly-once read-process-write point to a consumer group, because a share group gives up order and is at-least-once. Independent jobs with uneven processing time, more workers than partitions, or a real need for per-record `RELEASE`/`REJECT` and bounded retries point to a share group, which keeps the data on the Kafka platform you already run. A separate queue broker earns its place mainly for features share groups do not provide or when Kafka is not already paid for. The costs are real: a cluster on 4.2 or later with `share.version=1`, the `__share_group_state` topic, a rewrite to `KafkaShareConsumer`, a new group starting at `latest`, and new monitoring.
go deeper
Know that share groups suit independent jobs and consumer groups suit ordered streams, and that share groups are production-ready from Kafka 4.2.
List what a share group gives up — order, seek, exactly-once — and what it gains: workers beyond partitions and per-record retry.
Name the operational prerequisites: share.version, the state topic's replication, the latest start position, and the duplicate-on-expiry behaviour handlers must tolerate.
Own the platform call: which workloads move, which stay, whether a queue broker is retired, and who sets lock and delivery-limit policy per group.
## The decision Kafka now offers two consumption models on the same topics. A **consumer group** gives each partition one owner and tracks one offset per partition. A **share group** (KIP-932, production-ready since Kafka 4.2) lets many members read a partition, locks and acknowledges records one at a time, and counts delivery attempts. A third option remains: a separate queueing broker with per-message acknowledgement. There is no universally right answer; the work is matching the workload's real requirements to what each model gives and costs. ## When a share group is the better fit - **Records are independent jobs.** Any worker may take any record and the order of completion does not matter — image processing, notification sends, document indexing. - **Workers must outnumber partitions, or scale faster than partitions can.** A share group grows past the partition count without repartitioning, which matters when processing time per record is long or uneven. - **Per-record failure handling is wanted.** `RELEASE` for retry, `REJECT` for unprocessable records and a counted delivery limit replace hand-built retry bookkeeping around offsets. - **The data is already in Kafka.** One platform to secure, monitor and pay for; the same topic can feed consumer groups for analytics and a share group for the job queue at once, each independently. ## When to stay on a consumer group - **Order matters.** Per-key or per-partition processing order is the consumer group's core guarantee and exactly what a share group gives up. - **State is keyed.** Aggregations, joins and caches that need each key on one instance rely on stable partition ownership. - **Exactly-once read-process-write.** Kafka's transactional pattern commits consumer-group offsets inside the producer's transaction. Treat a share group as at-least-once: a lock that expires after processing means a redelivery, so handlers must be idempotent. - **The consumer needs to steer its position.** `seek()` and `assign()` exist on `KafkaConsumer`, not on `KafkaShareConsumer`; a share group is repositioned only by an operator, with `kafka-share-groups.sh --reset-offsets` while it has no active members. ## When a separate queue broker may still win If the requirement is a queue feature this Kafka release does not describe for share groups — message priorities, per-message delayed delivery, broker-managed dead-letter routing — or very low-volume request queues where Kafka's operational footprint is not already paid for, a dedicated queue broker can be the cheaper answer. Note that a share group archives a record that exhausts its attempts; it does not route it anywhere, so dead-lettering stays an application job. ## Costs of adopting share groups | Cost | Detail | |---|---| | Cluster version | production-ready from 4.2; 4.2.1 carries a fix for a critical deadlock in the share-group path | | Feature flag | `share.version=1`; a preview opt-in on 4.1, the default feature level once a cluster is at release version 4.2 | | Internal topic | `__share_group_state`, 3 replicas by default; smaller clusters must lower `share.coordinator.state.topic.replication.factor` and `share.coordinator.state.topic.min.isr` | | New client API | `KafkaShareConsumer`, different configs, no `seek()`; consumer code is rewritten, not reconfigured | | Start position | group config `share.auto.offset.reset`, default `latest`; a new group skips the existing backlog | | Broker limits | in-flight locks per share-partition (`group.share.partition.max.record.locks`, 2000) and members per group (`group.share.max.size`, 200) | | Tooling | `kafka-share-groups.sh` and share-group metrics instead of the consumer-group lag tooling teams already run | ## A way to decide 1. Write down whether the workload needs **ordering**, **keyed state** or **exactly-once**. Any yes points to a consumer group. 2. If not, check whether the needed parallelism exceeds a sensible partition count, or per-record retry is a real requirement. If yes, a share group earns its cost. 3. Price the platform work: cluster upgrade to at least 4.2 (prefer 4.2.1 or later), enabling `share.version`, client rewrites, new dashboards and runbooks. 4. Pilot one workload, measure redelivery and archive rates, then write the team default down — including who owns the group configs for lock duration and delivery limit. ## How share groups are switched on On 4.1 the preview was enabled with `kafka-features.sh --bootstrap-server <host:port> upgrade --feature share.version=1`. From 4.2, `share.version` level 1 is the default for metadata version 4.2, so finalizing an upgrade with `kafka-features.sh upgrade --release-version 4.2` (or later) turns it on along with the other features of that release. The deprecated `group.coordinator.rebalance.protocols` broker config is on its way out in 5.0, when feature versions alone will control which group types are available.
- A team moves an existing job topic from a consumer group to a new share group; what can go wrong on day one?The new share group starts at `latest` because `share.auto.offset.reset` defaults to that, so the existing backlog is skipped; set the group config to `earliest` (or a `by_duration` value) with `kafka-configs.sh --entity-type groups` before the group first consumes. Handlers written for one-owner partitions may also assume order or exclusive keys, and duplicate work appears whenever a lock expires mid-processing.
- What must be in place before share groups work on a Kafka test cluster with fewer than three brokers?Share groups store their state in the internal `__share_group_state` topic, created on first use with 3 replicas by default. On a cluster with fewer than 3 brokers, set `share.coordinator.state.topic.replication.factor` and `share.coordinator.state.topic.min.isr` to 1 before using them, and make sure `share.version` is at 1.
- A share group is a drop-in replacement for any consumer group.
- Share groups give exactly-once processing because each record is acknowledged.
- Moving to a share group is just a client configuration change.
- Kafka cannot act as a work queue, so a separate broker is always needed.
- A new share group reads the topic from the beginning by default.
Assumes Apache Kafka 4.2 or later, where share groups are production-ready; 4.1 shipped them as a preview behind share.version=1.