GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — [improve][broker] Avoid redundant read-completion executor handoffs for Exclusive/Failover by lhotari · Pull Request #26619 · apache/pulsar Conversation
Member
MotivationWith many producers publishing to one persistent topic, publish completions can saturate the topic's ordered managed-ledger executor. Consumers then cannot keep up with the publish rate, causing a significant subscription backlog. Adding broker cores does not eliminate this per-topic serialization bottleneck; faster cores may raise the saturation point, but leave consumer dispatch dependent on the same saturated executor. For Exclusive and Failover subscriptions, a cached read initiated by the dispatcher sends its successful completion to the managed-ledger executor before Modifications
Correctness and orderingConfirmed positions remain the read-visibility boundary. Ordering follows the cursor's ordered reads and the dispatcher's read lifecycle, rather than the identity of the successful-completion thread:
Verifying this change
Local validation passed: full A fresh baseline/candidate integration comparison after rebasing onto upstream master used 500 producers on 500 isolated v4 client connections, one Exclusive consumer, one persistent topic, 12 million unbatched 128-byte messages, unrestricted publishing and 40 outstanding sends per producer. Both runs consumed all 12 million messages with zero failed ACKs, one broker startup and no OOM. Only this scenario was measured for this comparison; the other YAML variations are available for follow-up runs.
Steady dispatch uses topic Whole-run throughput uses each Whole-run consumer throughput improved 85.2%, and steady dispatch kept up with ingress instead of accumulating millions of messages. CPU, lock and allocation profiles were collected with This is one sequential run pair on an 8-core/16-thread i9-9980HK with performance power settings and SMT enabled. Both runs experienced thermal throttling (steady maxima 98°C/95°C), so exact capacity differences need repetition under controlled cooling. Broker allocation per second is not an equal-work comparison because the candidate delivers substantially more messages during publishing. Related BookKeeper batch-read queueingFurther investigation identified a separate redundant completion queue in BookKeeper, reported as apache/bookkeeper#4893. In a separate controlled follow-up with 500 producer connections and one Exclusive consumer, removing only that BookKeeper queue increased steady dispatch from 5,435 to 9,894 messages/s, while ingress remained 105,314 messages/s with the change. The mean BookKeeper read-future duration fell from 169.4 to 92.7 ms, but the first response-to-worker queue still took 84.7 ms. The consumer still accumulated a sampled peak backlog of 10,432,707 messages. Both runs consumed all 12 million messages with zero failed ACKs, no broker restart and no OOM. Thus the measured BookKeeper-only prototype reached about 10k messages/s during publishing, still far below the publish rate. This is a separate comparison using a dispatcher variant with coalesced read requests, channel-writability-based resumption, and 256/128 KiB channel watermarks; it is not another measurement of the baseline/candidate pair above. Both runs reached 98°C and throttled, so treat the precise rates as scenario-specific. This PR lets already-confirmed cache hits complete without the extra managed-ledger queue hop. Does this pull request potentially affect one of the following parts:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsAllow self-dispatching read callbacks to complete on the current thread while retaining the Exclusive/Failover dispatcher executor boundary. Add callback affinity and failure coverage, a handoff benchmark, and reproducible YAML profiling scenarios. Assisted-by: Codex
4 of 11 tasks
void-ptr974
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice improvement. Removing the unnecessary managed-ledger executor handoff brings a significant performance gain for Exclusive/Failover consumers, especially under heavy producer load. I also like that this is implemented as an opt-in mechanism rather than changing the callback threading behavior globally. This keeps the change well scoped and also provides a useful foundation for similar optimizations in other consumer paths. LGTM.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
merlimat
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Radiancebobo
pushed a commit
to Radiancebobo/pulsar
that referenced
this pull request
…or Exclusive/Failover (apache#26619)
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |