-
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][ml] Use lock-free queue in InflightReadsLimiter since there's no concurrent access #23962
base: master
Are you sure you want to change the base?
Conversation
@guan46 Just curious to know: how do you know that this improves performance? What's your use case and what are you measuring? |
This PR is correct, but just interested to know more about the motivation behind this PR. @guan46 Please run CI in your own fork as a first verification step. That ensures that this change doesn't break something and you'll be able to work on the changes without needing someone to spend time in checking if this PR is ok or not. |
SpscArrayQueue has a memory barrier to ensure data consistency in concurrent situations, whereas ArrayDeque has no memory barrier. ArrayDeque can improve performance in non-concurrent situations @lhotari |
@guan46 Yes, I agree on that. I'm not against the changes in this PR. If you are looking for future contribution opportunities in Pulsar, you can always ask for suggestions on the dev channel in Pulsar Slack. Joining the Pulsar bi-weekly community meeting is a place where contributions are also discussed. I can help to find contribution opportunies with high impact. Regarding the "performance improvement" aspect: This PR won't improve performance so that you'd be able to measure the difference. One reason for this is that the queue is only used when permits are all used. |
All the tests of my repo have passed, please take a look.Thank you! @lhotari |
I can't get into pulsar's workspace.Could you help me? @lhotari |
@guan46 you will be able to join with the link at https://pulsar.apache.org/community/#section-discussions or |
All the tests of my repo have passed, please take a look. @lhotari |
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.
Please check the latest review comment.
if (maxReadsInFlightSize > 0) { | ||
enabled = true; | ||
this.queuedHandles = new SpscArrayQueue<>(maxReadsInFlightAcquireQueueSize); | ||
this.queuedHandles = new ArrayDeque<>(maxReadsInFlightAcquireQueueSize); |
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.
ArrayDeque takes an initial capacity as the parameter. The purpose is maxReadsInFlightAcquireQueueSize
is to limit the capacity. It doesn't make sense to allocate the buffer upfront. Simply remove the maxReadsInFlightAcquireQueueSize
parameter.
Motivation
Modifications
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: guan46#7