[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.
there is still the possibility of inconsistent status in the concurrent scenario, but I'm not sure whether it is a problem.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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.
🚀 New features to boost your workflow:
|
@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
isActvevar in ManagedCursorImpl in order to minimize the access toactiveCursorsinManagedLedgerImplVerifying 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
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: heesung-sohn#23