[fix][broker][branch-4.0] Revert "[improve][broker] Reduce memory occupation of the delayed message queue (#23611)"#24429
Merged
codelipenghui merged 2 commits intoJun 19, 2025
Conversation
This reverts commit addae4b.
…sage queue (apache#23611)" This reverts commit fcd4436.
Contributor
Author
|
/pulsarbot run-failure-checks |
Contributor
Where is the flame graph? |
Contributor
Author
|
@BewareMyPower Uploaded. I have been attached to the mailing list before. Forgot to add them here. |
Technoboy-
approved these changes
Jun 19, 2025
poorbarcode
approved these changes
Jun 19, 2025
shibd
approved these changes
Jun 19, 2025
ganesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jun 19, 2025
…upation of the delayed message queue (apache#23611)" (apache#24429) (cherry picked from commit f962d22)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jun 30, 2025
…upation of the delayed message queue (apache#23611)" (apache#24429) (cherry picked from commit f962d22)
11 tasks
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
Reason for Revert:
This PR has introduced a significant performance regression in the Pulsar broker.
The attached flame graph visually demonstrates increased CPU utilization and time
spent in the code paths related to DelayedDeliveryTracker and stream operations.
While the intention was to optimize memory usage, the current implementation
appears to have an adverse effect on CPU performance, leading to overall degraded
broker throughput and increased latency.
Impact:
This regression is impacting the stability and performance of our Pulsar clusters,
especially when you have large-scale delayed messages. Reverting the change will
allow us to restore the previous performance characteristics while we investigate
a more robust and performant solution for DelayedDeliveryTracker memory optimization.
Root Cause:
https://github.com/apache/pulsar/pull/23611/files#diff-f159b4e262ff6213bba19d20e6dc01d07ea8c19f4675524e4ceb1470f456e8fcR229-R231
Here is the change that caused this issue. Each message added to the
DelayedMessageTracker will call
getNumberOfDelayedMessages()methodwhich will iterate the map defined in InMemoryDelayedDeliveryTracker
More contexts:
Flamegraph:

Jstack:
Modifications
Revert PR #23611 and the related PR #24035
Documentation
docdoc-requireddoc-not-neededdoc-complete