Copilot commented on code in PR #21170: URL: https://github.com/apache/kafka/pull/21170#discussion_r2661813617
########## docs/streams/developer-guide/streams-rebalance-protocol.md: ########## @@ -0,0 +1,253 @@ +--- +title: Streams Rebalance Protocol +description: +weight: 14 +tags: ['kafka', 'docs'] +aliases: +keywords: +type: docs +--- + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +The Streams Rebalance Protocol is a broker-driven rebalancing system designed specifically for Kafka Streams applications. Following the pattern of KIP-848, which moved rebalance coordination of plain consumers from clients to brokers, KIP-1071 extends this model to Kafka Streams workloads. + +## Overview + +Instead of clients computing new assignments on the client during rebalance events involving all members of the group, assignments are computed continuously on the broker. Instead of using a consumer group, the streams application registers as a **streams group** with the broker, which manages and exposes all metadata required for coordination of the streams application instances. + +This approach brings Kafka Streams coordination in line with the modern broker-driven rebalance model introduced for consumers in KIP-848, providing a dedicated group type with streams-specific semantics and metadata management. + +## What's Supported in This Version + +The following features are available in the current release: + +* **Core Streams Group Rebalance Protocol**: The `group.protocol=streams` configuration enables the dedicated streams rebalance protocol. This separates streams groups from consumer groups and provides a streams-specific group membership lifecycle and metadata management on the broker. + +* **Sticky Task Assignor**: A basic task assignment strategy that minimizes task movement during rebalances is included. + +* **Interactive Query Support**: IQ operations are compatible with the new streams protocol. + +* **New Admin RPC**: The StreamsGroupDescribe RPC provides streams-specific metadata separate from consumer group information, with corresponding access via the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html). + +* **CLI Integration**: You can list, describe, and delete streams groups via the [kafka-streams-groups.sh](kafka-streams-group-sh.md) script. Review Comment: The link references a file 'kafka-streams-group-sh.md' which doesn't exist in the repository. This will result in broken links in the documentation. The documentation should either include the referenced file or use a different link target. ```suggestion * **CLI Integration**: You can list, describe, and delete streams groups via the `kafka-streams-groups.sh` script. ``` ########## docs/streams/developer-guide/streams-rebalance-protocol.md: ########## @@ -0,0 +1,253 @@ +--- +title: Streams Rebalance Protocol +description: +weight: 14 +tags: ['kafka', 'docs'] +aliases: +keywords: +type: docs +--- + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +The Streams Rebalance Protocol is a broker-driven rebalancing system designed specifically for Kafka Streams applications. Following the pattern of KIP-848, which moved rebalance coordination of plain consumers from clients to brokers, KIP-1071 extends this model to Kafka Streams workloads. + +## Overview + +Instead of clients computing new assignments on the client during rebalance events involving all members of the group, assignments are computed continuously on the broker. Instead of using a consumer group, the streams application registers as a **streams group** with the broker, which manages and exposes all metadata required for coordination of the streams application instances. + +This approach brings Kafka Streams coordination in line with the modern broker-driven rebalance model introduced for consumers in KIP-848, providing a dedicated group type with streams-specific semantics and metadata management. + +## What's Supported in This Version + +The following features are available in the current release: + +* **Core Streams Group Rebalance Protocol**: The `group.protocol=streams` configuration enables the dedicated streams rebalance protocol. This separates streams groups from consumer groups and provides a streams-specific group membership lifecycle and metadata management on the broker. + +* **Sticky Task Assignor**: A basic task assignment strategy that minimizes task movement during rebalances is included. + +* **Interactive Query Support**: IQ operations are compatible with the new streams protocol. + +* **New Admin RPC**: The StreamsGroupDescribe RPC provides streams-specific metadata separate from consumer group information, with corresponding access via the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html). + +* **CLI Integration**: You can list, describe, and delete streams groups via the [kafka-streams-groups.sh](kafka-streams-group-sh.md) script. + +* **Offline Migration**: After shutting down all members and waiting for their `session.timeout.ms` to expire, a classic group can be converted to a streams group and a streams group can be converted to a classic group. The only thing that will be preserved broker-side are the committed offsets of the application. + +## What's Not Supported in This Version + +The following features are not yet available and should be avoided when using the new protocol: + +* **Static Membership**: Setting a client `instance.id` will be rejected. + +* **Topology Updates**: If a topology is changed significantly (e.g., by adding new source topics or changing the number of sub-topologies), a new streams group must be created. + +* **High Availability Assignor**: Only the sticky assignor is supported. + +* **Regular Expressions**: Pattern-based topic subscription is not supported. + +* **Online Migration**: Group migration while the application is running is not available between the classic and new streams protocol. + +## Why Use the Streams Rebalance Protocol? + +The Streams Rebalance Protocol offers several key advantages over the classic client-driven protocol: + +* **Broker-Driven Coordination**: Centralizes task assignment logic on brokers instead of the client. This provides consistent, authoritative task assignment decisions from a single coordination point and reduces the potential for split-brain scenarios. + +* **Faster, More Stable Rebalances**: Reduces rebalance duration and impact by removing the global synchronization point. This minimizes application downtime during membership changes or failures. + +* **Better Observability**: Provides dedicated metrics and admin interfaces that separate streams from consumer groups, leading to clearer troubleshooting with broker-side observability. See the [streams groups metrics]({{< relref "/43/operations/monitoring#group-coordinator-monitoring" >}}) documentation for details. + +## Enabling the Protocol + +The Streams Rebalance Protocol is enabled by default on new clusters starting with Apache Kafka 4.2. Both brokers and clients must be running Apache Kafka 4.2 or later to use this protocol. + +### Broker Configuration + +The protocol is enabled by default on new Apache Kafka 4.2 clusters. To enable the feature on existing clusters or to explicitly control it: + +Enable the feature: +``` +kafka-features.sh --bootstrap-server localhost:9092 upgrade --feature streams.version=1 +``` + +Disable the feature: +``` +kafka-features.sh --bootstrap-server localhost:9092 downgrade --feature streams.version=0 +``` + +### Client Configuration + +In your Kafka Streams application configuration, set: +``` +group.protocol=streams +``` + +## Configuration + +### Broker Configuration + +The following broker configurations control the behavior of streams groups. For complete details, see the [broker configuration]({{< relref "/43/configuration/broker-configs" >}}) documentation. + +* [`group.coordinator.rebalance.protocols`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.coordinator.rebalance.protocols" >}}): The list of enabled rebalance protocols. `"streams"` is included in the list of protocols to enable streams groups. +* [`group.streams.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.session.timeout.ms" >}}): The timeout to detect client failures when using the streams group protocol. +* [`group.streams.min.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.min.session.timeout.ms" >}}): The minimum session timeout. +* [`group.streams.max.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.session.timeout.ms" >}}): The maximum session timeout. +* [`group.streams.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.heartbeat.interval.ms" >}}): The heartbeat interval given to the members. +* [`group.streams.min.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.min.heartbeat.interval.ms" >}}): The minimum heartbeat interval. +* [`group.streams.max.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.heartbeat.interval.ms" >}}): The maximum heartbeat interval. +* [`group.streams.max.size`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.size" >}}): The maximum number of streams clients that a single streams group can accommodate. +* [`group.streams.num.standby.replicas`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.num.standby.replicas" >}}): The number of standby replicas for each task. +* [`group.streams.max.standby.replicas`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.standby.replicas" >}}): Maximum for dynamic configurations of the standby replica configuration. +* [`group.streams.initial.rebalance.delay.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.initial.rebalance.delay.ms" >}}): The first rebalance of a group is delayed by this amount to allow more members to join the group. + +### Group Configuration + +Configurations for the resource type `GROUP` are available in `DescribeConfigs` and `IncrementalAlterConfigs` to override the default broker configurations dynamically for specific groups. These can be set using the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html) Java interface or the `kafka-configs.sh` utility. + +For complete details, see the [group configuration]({{< relref "/43/configuration/group-configs" >}}) documentation. + +The following group-level configurations are available for streams groups: + +* [`streams.session.timeout.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.session.timeout.ms" >}}): The timeout to detect client failures when using the streams group protocol. +* [`streams.heartbeat.interval.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.heartbeat.interval.ms" >}}): The heartbeat interval given to the members. +* [`streams.num.standby.replicas`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.num.standby.replicas" >}}): The number of standby replicas for each task. +* [`streams.initial.rebalance.delay.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.initial.rebalance.delay.ms" >}}): The first rebalance of a group is delayed by this amount to allow more members to join the group. + +#### Example: Setting Group-Level Configuration +``` +kafka-configs.sh --bootstrap-server localhost:9092 \ + --alter --entity-type groups --entity-name wordcount \ + --add-config streams.num.standby.replicas=1 +``` + +**Note:** In the streams rebalance protocol, `session.timeout.ms`, `heartbeat.interval.ms` and `num.standby.replicas` are group-level configurations, which are ignored when they are set on the client side. Use the `kafka-configs.sh` tool to set these configurations as shown above. + +### Streams Configuration + +For complete details on all Kafka Streams configurations, see the [streams configuration]({{< relref "/43/configuration/kafka-streams-configs" >}}) documentation. + +The following client configuration enables the streams rebalance protocol: + +* [`group.protocol`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_group.protocol" >}}): A flag which indicates if the streams rebalance protocol should be used. Set to `streams` to enable (default is `classic`). + +#### Ignored Configurations + +The following configurations are ignored when the streams rebalance protocol is enabled: +* [`acceptable.recovery.lag`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_acceptable.recovery.lag" >}}) +* [`max.warmup.replicas`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_max.warmup.replicas" >}}) +* [`num.standby.replicas`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_num.standby.replicas" >}}) (use group-level configuration instead) +* [`probing.rebalance.interval.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_probing.rebalance.interval.ms" >}}) +* [`rack.aware.assignment.tags`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.tags" >}}) +* [`rack.aware.assignment.strategy`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.strategy" >}}) +* [`rack.aware.assignment.traffic_cost`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.traffic_cost" >}}) +* [`rack.aware.assignment.non_overlap_cost`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.non_overlap_cost" >}}) +* [`task.assignor.class`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_task.assignor.class" >}}) +* [`session.timeout.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_session.timeout.ms" >}}) (use group-level configuration instead) +* [`heartbeat.interval.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_heartbeat.interval.ms" >}}) (use group-level configuration instead) + +## Administration + +### Admin API + +Use the "streams groups" methods of the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html) interface to manage streams groups programmatically. These APIs are mostly backed by the same implementations as the consumer group API. + +The main differences from consumer group APIs are: + +* The `describeStreamsGroups` uses the DescribeStreamsGroup RPC and contains different information than consumer groups. +* A streams group has an extra state - `NOT_READY` - and no legacy states from the classic protocol. +* `removeMembersFromConsumerGroup` will not have a corresponding API in this version, as it uses the LeaveGroup RPC for classic consumer groups, which is not available for KIP-848-style groups. + +### kafka-streams-groups.sh + +A new tool called [kafka-streams-groups.sh](kafka-streams-group-sh.md) is added for working with streams groups. It replaces `kafka-streams-application-reset` for streams groups and can be used to list, describe, and delete streams groups. See the [kafka-streams-groups.sh documentation](kafka-streams-group-sh.md) for detailed usage information. + +## Architecture and How It Works + +### Streams Groups + +The protocol introduces the concept of a **streams group** in parallel to a consumer group. Streams clients use a dedicated heartbeat RPC, `StreamsGroupHeartbeat`, to join a group, leave a group, and update the group coordinator about its currently owned tasks and its client-specific metadata. + +The group coordinator manages a streams group similarly to a consumer group, continuously updating the group member metadata via heartbeat responses and running assignment logic when changes are detected. A new group type called `streams` is introduced to the group coordinator, with new record key and value types for group metadata, topology metadata, and group member metadata. These records are persisted in the `__consumer_offsets` topic. + +A group can either be a streams group, a share group, or a consumer group, defined by the first heartbeat request using the corresponding GroupId. + +### Topology Configuration and Validation + +To assign tasks among streams clients, the group coordinator uses topology metadata that is initialized when a member joins the group and persisted in the consumer offsets topic. + +Whenever a member joins the streams group, the first heartbeat request contains metadata of the topology. The metadata describes the topology as a set of subtopologies, each identified by a unique string identifier and containing metadata relevant for creation of internal topics and assignment. + +#### Topology Validation and NOT_READY State + +During the handling of the streams group heartbeat, the group coordinator may detect that source/sink or internal topics required by the topology do not exist or differ in their configuration from what is required for the topology to execute successfully. This triggers a "topology configuration" process, in which the group coordinator performs the following steps: + +* Check that all source topics exist and resolve source topic regular expressions (checking that each resolves to at least one topic). Review Comment: There's an inconsistency in the documentation. Line 62 states "Regular Expressions: Pattern-based topic subscription is not supported," but line 200 in the Architecture section mentions "resolve source topic regular expressions (checking that each resolves to at least one topic)." This creates confusion about whether regular expressions are supported or not. The documentation should clarify this apparent contradiction, perhaps distinguishing between different types of regex support or correcting one of these statements. ```suggestion * Check that all configured source topics exist. ``` ########## docs/streams/developer-guide/streams-rebalance-protocol.md: ########## @@ -0,0 +1,253 @@ +--- +title: Streams Rebalance Protocol +description: +weight: 14 +tags: ['kafka', 'docs'] +aliases: +keywords: +type: docs +--- + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +The Streams Rebalance Protocol is a broker-driven rebalancing system designed specifically for Kafka Streams applications. Following the pattern of KIP-848, which moved rebalance coordination of plain consumers from clients to brokers, KIP-1071 extends this model to Kafka Streams workloads. + +## Overview + +Instead of clients computing new assignments on the client during rebalance events involving all members of the group, assignments are computed continuously on the broker. Instead of using a consumer group, the streams application registers as a **streams group** with the broker, which manages and exposes all metadata required for coordination of the streams application instances. + +This approach brings Kafka Streams coordination in line with the modern broker-driven rebalance model introduced for consumers in KIP-848, providing a dedicated group type with streams-specific semantics and metadata management. + +## What's Supported in This Version + +The following features are available in the current release: + +* **Core Streams Group Rebalance Protocol**: The `group.protocol=streams` configuration enables the dedicated streams rebalance protocol. This separates streams groups from consumer groups and provides a streams-specific group membership lifecycle and metadata management on the broker. + +* **Sticky Task Assignor**: A basic task assignment strategy that minimizes task movement during rebalances is included. + +* **Interactive Query Support**: IQ operations are compatible with the new streams protocol. + +* **New Admin RPC**: The StreamsGroupDescribe RPC provides streams-specific metadata separate from consumer group information, with corresponding access via the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html). + +* **CLI Integration**: You can list, describe, and delete streams groups via the [kafka-streams-groups.sh](kafka-streams-group-sh.md) script. + +* **Offline Migration**: After shutting down all members and waiting for their `session.timeout.ms` to expire, a classic group can be converted to a streams group and a streams group can be converted to a classic group. The only thing that will be preserved broker-side are the committed offsets of the application. + +## What's Not Supported in This Version + +The following features are not yet available and should be avoided when using the new protocol: + +* **Static Membership**: Setting a client `instance.id` will be rejected. + +* **Topology Updates**: If a topology is changed significantly (e.g., by adding new source topics or changing the number of sub-topologies), a new streams group must be created. Review Comment: Inconsistent terminology: this line uses "sub-topologies" with a hyphen, but the established convention in the codebase is "subtopologies" without a hyphen (see line 194 of the same file, and docs/streams/developer-guide/config-streams.md:1365, docs/streams/upgrade-guide.md:244,344). Please use "subtopologies" for consistency. ```suggestion * **Topology Updates**: If a topology is changed significantly (e.g., by adding new source topics or changing the number of subtopologies), a new streams group must be created. ``` ########## docs/streams/developer-guide/streams-rebalance-protocol.md: ########## @@ -0,0 +1,253 @@ +--- +title: Streams Rebalance Protocol +description: +weight: 14 +tags: ['kafka', 'docs'] +aliases: +keywords: +type: docs +--- + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +The Streams Rebalance Protocol is a broker-driven rebalancing system designed specifically for Kafka Streams applications. Following the pattern of KIP-848, which moved rebalance coordination of plain consumers from clients to brokers, KIP-1071 extends this model to Kafka Streams workloads. + +## Overview + +Instead of clients computing new assignments on the client during rebalance events involving all members of the group, assignments are computed continuously on the broker. Instead of using a consumer group, the streams application registers as a **streams group** with the broker, which manages and exposes all metadata required for coordination of the streams application instances. + +This approach brings Kafka Streams coordination in line with the modern broker-driven rebalance model introduced for consumers in KIP-848, providing a dedicated group type with streams-specific semantics and metadata management. + +## What's Supported in This Version + +The following features are available in the current release: + +* **Core Streams Group Rebalance Protocol**: The `group.protocol=streams` configuration enables the dedicated streams rebalance protocol. This separates streams groups from consumer groups and provides a streams-specific group membership lifecycle and metadata management on the broker. + +* **Sticky Task Assignor**: A basic task assignment strategy that minimizes task movement during rebalances is included. + +* **Interactive Query Support**: IQ operations are compatible with the new streams protocol. + +* **New Admin RPC**: The StreamsGroupDescribe RPC provides streams-specific metadata separate from consumer group information, with corresponding access via the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html). + +* **CLI Integration**: You can list, describe, and delete streams groups via the [kafka-streams-groups.sh](kafka-streams-group-sh.md) script. + +* **Offline Migration**: After shutting down all members and waiting for their `session.timeout.ms` to expire, a classic group can be converted to a streams group and a streams group can be converted to a classic group. The only thing that will be preserved broker-side are the committed offsets of the application. + +## What's Not Supported in This Version + +The following features are not yet available and should be avoided when using the new protocol: + +* **Static Membership**: Setting a client `instance.id` will be rejected. + +* **Topology Updates**: If a topology is changed significantly (e.g., by adding new source topics or changing the number of sub-topologies), a new streams group must be created. + +* **High Availability Assignor**: Only the sticky assignor is supported. + +* **Regular Expressions**: Pattern-based topic subscription is not supported. + +* **Online Migration**: Group migration while the application is running is not available between the classic and new streams protocol. + +## Why Use the Streams Rebalance Protocol? + +The Streams Rebalance Protocol offers several key advantages over the classic client-driven protocol: + +* **Broker-Driven Coordination**: Centralizes task assignment logic on brokers instead of the client. This provides consistent, authoritative task assignment decisions from a single coordination point and reduces the potential for split-brain scenarios. + +* **Faster, More Stable Rebalances**: Reduces rebalance duration and impact by removing the global synchronization point. This minimizes application downtime during membership changes or failures. + +* **Better Observability**: Provides dedicated metrics and admin interfaces that separate streams from consumer groups, leading to clearer troubleshooting with broker-side observability. See the [streams groups metrics]({{< relref "/43/operations/monitoring#group-coordinator-monitoring" >}}) documentation for details. + +## Enabling the Protocol + +The Streams Rebalance Protocol is enabled by default on new clusters starting with Apache Kafka 4.2. Both brokers and clients must be running Apache Kafka 4.2 or later to use this protocol. + +### Broker Configuration + +The protocol is enabled by default on new Apache Kafka 4.2 clusters. To enable the feature on existing clusters or to explicitly control it: + +Enable the feature: +``` +kafka-features.sh --bootstrap-server localhost:9092 upgrade --feature streams.version=1 +``` + +Disable the feature: +``` +kafka-features.sh --bootstrap-server localhost:9092 downgrade --feature streams.version=0 +``` + +### Client Configuration + +In your Kafka Streams application configuration, set: +``` +group.protocol=streams +``` + +## Configuration + +### Broker Configuration + +The following broker configurations control the behavior of streams groups. For complete details, see the [broker configuration]({{< relref "/43/configuration/broker-configs" >}}) documentation. + +* [`group.coordinator.rebalance.protocols`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.coordinator.rebalance.protocols" >}}): The list of enabled rebalance protocols. `"streams"` is included in the list of protocols to enable streams groups. +* [`group.streams.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.session.timeout.ms" >}}): The timeout to detect client failures when using the streams group protocol. +* [`group.streams.min.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.min.session.timeout.ms" >}}): The minimum session timeout. +* [`group.streams.max.session.timeout.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.session.timeout.ms" >}}): The maximum session timeout. +* [`group.streams.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.heartbeat.interval.ms" >}}): The heartbeat interval given to the members. +* [`group.streams.min.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.min.heartbeat.interval.ms" >}}): The minimum heartbeat interval. +* [`group.streams.max.heartbeat.interval.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.heartbeat.interval.ms" >}}): The maximum heartbeat interval. +* [`group.streams.max.size`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.size" >}}): The maximum number of streams clients that a single streams group can accommodate. +* [`group.streams.num.standby.replicas`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.num.standby.replicas" >}}): The number of standby replicas for each task. +* [`group.streams.max.standby.replicas`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.max.standby.replicas" >}}): Maximum for dynamic configurations of the standby replica configuration. +* [`group.streams.initial.rebalance.delay.ms`]({{< relref "/43/configuration/broker-configs#brokerconfigs_group.streams.initial.rebalance.delay.ms" >}}): The first rebalance of a group is delayed by this amount to allow more members to join the group. + +### Group Configuration + +Configurations for the resource type `GROUP` are available in `DescribeConfigs` and `IncrementalAlterConfigs` to override the default broker configurations dynamically for specific groups. These can be set using the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html) Java interface or the `kafka-configs.sh` utility. + +For complete details, see the [group configuration]({{< relref "/43/configuration/group-configs" >}}) documentation. + +The following group-level configurations are available for streams groups: + +* [`streams.session.timeout.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.session.timeout.ms" >}}): The timeout to detect client failures when using the streams group protocol. +* [`streams.heartbeat.interval.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.heartbeat.interval.ms" >}}): The heartbeat interval given to the members. +* [`streams.num.standby.replicas`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.num.standby.replicas" >}}): The number of standby replicas for each task. +* [`streams.initial.rebalance.delay.ms`]({{< relref "/43/configuration/group-configs#groupconfigs_streams.initial.rebalance.delay.ms" >}}): The first rebalance of a group is delayed by this amount to allow more members to join the group. + +#### Example: Setting Group-Level Configuration +``` +kafka-configs.sh --bootstrap-server localhost:9092 \ + --alter --entity-type groups --entity-name wordcount \ + --add-config streams.num.standby.replicas=1 +``` + +**Note:** In the streams rebalance protocol, `session.timeout.ms`, `heartbeat.interval.ms` and `num.standby.replicas` are group-level configurations, which are ignored when they are set on the client side. Use the `kafka-configs.sh` tool to set these configurations as shown above. + +### Streams Configuration + +For complete details on all Kafka Streams configurations, see the [streams configuration]({{< relref "/43/configuration/kafka-streams-configs" >}}) documentation. + +The following client configuration enables the streams rebalance protocol: + +* [`group.protocol`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_group.protocol" >}}): A flag which indicates if the streams rebalance protocol should be used. Set to `streams` to enable (default is `classic`). + +#### Ignored Configurations + +The following configurations are ignored when the streams rebalance protocol is enabled: +* [`acceptable.recovery.lag`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_acceptable.recovery.lag" >}}) +* [`max.warmup.replicas`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_max.warmup.replicas" >}}) +* [`num.standby.replicas`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_num.standby.replicas" >}}) (use group-level configuration instead) +* [`probing.rebalance.interval.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_probing.rebalance.interval.ms" >}}) +* [`rack.aware.assignment.tags`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.tags" >}}) +* [`rack.aware.assignment.strategy`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.strategy" >}}) +* [`rack.aware.assignment.traffic_cost`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.traffic_cost" >}}) +* [`rack.aware.assignment.non_overlap_cost`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_rack.aware.assignment.non_overlap_cost" >}}) +* [`task.assignor.class`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_task.assignor.class" >}}) +* [`session.timeout.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_session.timeout.ms" >}}) (use group-level configuration instead) +* [`heartbeat.interval.ms`]({{< relref "/43/configuration/kafka-streams-configs#streamsconfigs_heartbeat.interval.ms" >}}) (use group-level configuration instead) + +## Administration + +### Admin API + +Use the "streams groups" methods of the [`Admin`](/43/javadoc/org/apache/kafka/clients/admin/Admin.html) interface to manage streams groups programmatically. These APIs are mostly backed by the same implementations as the consumer group API. + +The main differences from consumer group APIs are: + +* The `describeStreamsGroups` uses the DescribeStreamsGroup RPC and contains different information than consumer groups. +* A streams group has an extra state - `NOT_READY` - and no legacy states from the classic protocol. +* `removeMembersFromConsumerGroup` will not have a corresponding API in this version, as it uses the LeaveGroup RPC for classic consumer groups, which is not available for KIP-848-style groups. + +### kafka-streams-groups.sh + +A new tool called [kafka-streams-groups.sh](kafka-streams-group-sh.md) is added for working with streams groups. It replaces `kafka-streams-application-reset` for streams groups and can be used to list, describe, and delete streams groups. See the [kafka-streams-groups.sh documentation](kafka-streams-group-sh.md) for detailed usage information. Review Comment: The link references a file 'kafka-streams-group-sh.md' which doesn't exist in the repository. This will result in broken links in the documentation. The documentation should either include the referenced file or use a different link target. ```suggestion A new tool called [kafka-streams-groups.sh](kafka-streams-groups-sh.md) is added for working with streams groups. It replaces `kafka-streams-application-reset` for streams groups and can be used to list, describe, and delete streams groups. See the [kafka-streams-groups.sh documentation](kafka-streams-groups-sh.md) for detailed usage information. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
