-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][broker] Make Consumer#equals more effective #18662
Merged
tisonkun
merged 1 commit into
apache:master
from
Shawyeok:improve-consumer-equals-performance
Nov 29, 2022
Merged
[improve][broker] Make Consumer#equals more effective #18662
tisonkun
merged 1 commit into
apache:master
from
Shawyeok:improve-consumer-equals-performance
Nov 29, 2022
Conversation
This file contains 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
hangc0276
approved these changes
Nov 29, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
codelipenghui
approved these changes
Nov 29, 2022
Technoboy-
approved these changes
Nov 29, 2022
tisonkun
approved these changes
Nov 29, 2022
AnonHxy
approved these changes
Nov 29, 2022
Thank you! Merging... |
lhotari
approved these changes
Nov 29, 2022
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Dec 9, 2022
liangyepianzhou
pushed a commit
that referenced
this pull request
Dec 14, 2022
(cherry picked from commit 9e821b0)
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Jan 10, 2023
Technoboy-
pushed a commit
that referenced
this pull request
Feb 8, 2023
coderzc
pushed a commit
that referenced
this pull request
Feb 28, 2023
(cherry picked from commit 9e821b0)
Annavar-satish
pushed a commit
to pandio-com/pulsar
that referenced
this pull request
Mar 6, 2023
(cherry picked from commit 9e821b0)
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/broker
cherry-picked/branch-2.9
Archived: 2.9 is end of life
cherry-picked/branch-2.10
cherry-picked/branch-2.11
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/2.9.5
release/2.10.3
release/2.11.1
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
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
It's from a production case in my org, one of our consumer application constantly create consumer instance after increase topic partition due to old pulsar-client bug. The application got OOM eventually and broker publish latency goes more than 30s, so many publish requests timeout, broker latency go back normal after application restart.
It could be reproduce below:
After stop consume program,
pulsar-io
thread will be block for a while, publish latency will be very high (35s+ in my case).It's a cpu profile during consumer stops:


The time complexity of
CopyOnWriteList.remove
is O(n), soConsumer#equals
method is a hot method.https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L192
Modifications
Flip
&&
expressionVerifying this change
This change is a trivial rework / code cleanup without any test coverage.
Documentation
doc-not-needed
Matching PR in forked repository
PR in forked repository: Shawyeok#5