Repository navigation
[improve][broker] Disable subscription-thread dispatch by default - #26578
Merged
lhotari merged 1 commit intoSep 14, 2026
Merged
Conversation
Assisted-by: Codex
lhotari
requested review from
Technoboy-,
dao-jun,
david-streamlio,
merlimat and
nodece
September 14, 2026 15:23
2 tasks done
merlimat
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
As discussed in #26576 (comment), enabling
dispatcherDispatchMessagesInSubscriptionThreadby default slows dispatching and increases resource consumption. Queuing entries for dispatch on a subscription thread prolongs their retention and can contribute to memory pressure and OOMs. The discussion also relates this to #24926.The additional thread handoff also increases CPU usage, context switches, and contention on mutexes.
Modifications
Change the default of
dispatcherDispatchMessagesInSubscriptionThreadfromtruetofalsein bothServiceConfigurationandconf/broker.conf. This uses the existing dispatch path without the additional subscription-thread handoff. Operators can explicitly set the option totrueto retain the previous behavior, including offloading expensive broker-side filters.Verifying this change
The existing
ServiceConfigurationTest.testConfigFileDefaultschecks that the Java defaults andconf/broker.confagree.Passed locally:
./gradlew quickCheck(including Spotless and main/test Checkstyle checks)./gradlew :pulsar-broker:test --tests org.apache.pulsar.common.naming.ServiceConfigurationTest.testConfigFileDefaults -PtestRetryCount=0No new performance measurements were collected for this default-only change.
Does this pull request potentially affect one of the following parts:
Brokers that do not explicitly configure this option will use
false. Existing configurations explicitly setting it totrueretain their behavior.