-
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] Added isActive in ManagedCursorImpl #19341
Conversation
ledger.deactivateCursor(this); | ||
if (isActive) { | ||
ledger.deactivateCursor(this); | ||
isActive = false; |
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.
there is still the possibility of inconsistent status in the concurrent scenario, but I'm not sure whether it is a problem.
Codecov Report
@@ Coverage Diff @@
## master #19341 +/- ##
=============================================
+ Coverage 32.42% 63.46% +31.04%
- Complexity 6347 25878 +19531
=============================================
Files 1644 1818 +174
Lines 123712 133107 +9395
Branches 13486 14644 +1158
=============================================
+ Hits 40109 84474 +44365
+ Misses 77694 40879 -36815
- Partials 5909 7754 +1845
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@mattisonchao I guess I had added it to be consistent with the other method |
(cherry picked from commit 96fb7da)
(cherry picked from commit 96fb7da)
(cherry picked from commit 74f40c9)
Motivation
When there are many concurrent subscriptions in a topic, broker performance degrades because many io-threads are waiting for the lock,
synchronized (activeCursors)
while callingcheckBackloggedCursors
.Modifications
Added the
isActve
var in ManagedCursorImpl in order to minimize the access toactiveCursors
inManagedLedgerImpl
Verifying this change
This change can be verified as follows:
simulate many concurrent subscriptions
before this PR
after this PR
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: heesung-sn#23