Skip to content

KAFKA-20210: Add group.coordinator.background.threads config#21555

Merged
dajac merged 8 commits intoapache:trunkfrom
confluentinc:squah-kip-1263-add-executor-threads
Mar 3, 2026
Merged

KAFKA-20210: Add group.coordinator.background.threads config#21555
dajac merged 8 commits intoapache:trunkfrom
confluentinc:squah-kip-1263-add-executor-threads

Conversation

@squah-confluent
Copy link
Contributor

@squah-confluent squah-confluent commented Feb 23, 2026

Add the group.coordinator.background.threads config option to control
the number of threads in the group coordinator's CoordinatorExecutor
thread pool.

Reviewers: Dongnuo Lyu dlyu@confluent.io, Chia-Ping Tsai
chia7712@gmail.com, PoAn Yang payang@apache.org, David Jacot
djacot@confluent.io

Add the group.coordinator.executor.threads config option to control the
number of threads in the group coordinator's CoordinatorExecutor thread
pool.
@github-actions github-actions bot added triage PRs from the community core Kafka Broker group-coordinator small Small PRs labels Feb 23, 2026
@dajac dajac added ci-approved and removed triage PRs from the community labels Feb 23, 2026
public static final int GROUP_COORDINATOR_NUM_THREADS_DEFAULT = 4;

public static final String GROUP_COORDINATOR_NUM_EXECUTOR_THREADS_CONFIG = "group.coordinator.executor.threads";
public static final String GROUP_COORDINATOR_NUM_EXECUTOR_THREADS_DOC = "The number of executor threads used by the group coordinator.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explain what they are used for? We may also want to extend the doc of the runtime threads.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the config docs. Let me know what you think!

Copy link
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch, @squah-confluent. I left a few more comments for consideration.

public static final String GROUP_COORDINATOR_NUM_THREADS_DOC = "The number of threads used by the group coordinator for processing requests.";
public static final int GROUP_COORDINATOR_NUM_THREADS_DEFAULT = 4;

public static final String GROUP_COORDINATOR_NUM_EXECUTOR_THREADS_CONFIG = "group.coordinator.executor.threads";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, I find the name of the config not very good, mainly because it is not clear why it does based on the name and it is not clear how it differs from group.coordinator.threads too. I wonder whether we should use something like group.coordinator.backgroup.threads. @squah-confluent @dongnuo123 Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be group.coordinator.background.threads?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the config.

Comment on lines +87 to +88
public static final String GROUP_COORDINATOR_NUM_EXECUTOR_THREADS_DOC = "The number of executor threads used by the group coordinator for " +
"updating the list of topics for regex subscriptions and metadata changes and offloaded assignments.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of executor threads used by the group coordinator for processing background/asynchronous tasks such as resolving regular expressions and computing assignments.

For the computing assignment part, we could mention the related config too when we add it.

.withCompression(Compression.of(config.offsetTopicCompressionType()).build())
.withAppendLingerMs(config.appendLingerMs())
.withExecutorService(Executors.newSingleThreadExecutor())
.withExecutorService(Executors.newFixedThreadPool(config.numExecutorThreads()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are here, would it be possible to give a proper name to the threads used here? We could follow the name we use for the config so administrators can connect the dots.

Copy link
Contributor Author

@squah-confluent squah-confluent Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've named the threads group-coordinator-background-<n>

@squah-confluent squah-confluent changed the title KAFKA-20210: Add group.coordinator.executor.threads config KAFKA-20210: Add group.coordinator.background.threads config Feb 25, 2026
.withExecutorService(Executors.newSingleThreadExecutor())
.withExecutorService(Executors.newFixedThreadPool(
config.numBackgroundThreads(),
runnable -> new KafkaThread(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It seems that we can now use Thread.ofPlatform().name("group-coordinator-background-", 0).factory() since Java 21. Does it work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can, since our min supported Java version is 17

minNonClientJavaVersion = 17

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 is for clients. We use a newer one on the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought 11 was for clients? I can't get it to compile locally unless I also bump the minNonClientJavaVersion to 21.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use Thread.ofPlatform() because the server-side code targets JDK 17, and the client-side code is still on JDK 11.

maybe we could use ThreadUtils.createThreadFactory("group-coordinator-background-%d", false) instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad... I was sure that we were already on 21. Using ThreadUtils.createThreadFactory makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've switched to ThreadUtils.createThreadFactory.

Comment on lines +87 to +88
public static final String GROUP_COORDINATOR_NUM_BACKGROUND_THREADS_DOC = "The number of background threads used by the group coordinator for " +
"updating the list of topics for regex subscriptions and metadata changes and offloaded assignments.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The number of threads used by the group coordinator for processing background tasks (e.g. regular expressions or assignments).? I don't get the metadata changes part in the current one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a typo! I meant to write "on metadata changes". Updated the description.

public static final String GROUP_COORDINATOR_NUM_THREADS_DOC = "The number of threads used by the group coordinator for processing requests.";
public static final int GROUP_COORDINATOR_NUM_THREADS_DEFAULT = 4;

public static final String GROUP_COORDINATOR_NUM_BACKGROUND_THREADS_CONFIG = "group.coordinator.background.threads";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this new config to upgrade.md?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am +1 for adding something but I would do it for the KIP, not for the config. Hence, I suggest to defer it to another PR. @squah-confluent Could you please file a ticket so we don't forget about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@FrankYang0529 FrankYang0529 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix.

Copy link
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dajac dajac merged commit 0653154 into apache:trunk Mar 3, 2026
36 of 39 checks passed
@dajac dajac deleted the squah-kip-1263-add-executor-threads branch March 3, 2026 06:48
nicktelford pushed a commit to nicktelford/kafka that referenced this pull request Mar 6, 2026
…21555)

Add the group.coordinator.background.threads config option to control
the  number of threads in the group coordinator's CoordinatorExecutor
thread  pool.

Reviewers: Dongnuo Lyu <dlyu@confluent.io>, Chia-Ping Tsai
 <chia7712@gmail.com>, PoAn Yang <payang@apache.org>, David Jacot
 <djacot@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants