pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][broker] Pin executor to managed ledger instance to cache the string hashing

Open merlimat opened this issue 3 years ago • 4 comments

Motivation

In many operations we're hashing on the managed ledger name to ensure all the callbacks are triggered from same thread. Instead of hashing the string each, let's pin the thread and always use the same, for a given managed ledger instance.

This will avoid the hashing overhead.

Tests in https://github.com/merlimat/pulsar/pull/3

  • [ ] doc
  • [ ] doc-required
  • [X] doc-not-needed
  • [ ] doc-complete

merlimat avatar Oct 17 '22 21:10 merlimat

@merlimat Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

github-actions[bot] avatar Oct 17 '22 21:10 github-actions[bot]

Codecov Report

Merging #18078 (66fc80a) into master (cee697b) will decrease coverage by 0.49%. The diff coverage is 19.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18078      +/-   ##
============================================
- Coverage     47.06%   46.56%   -0.50%     
- Complexity     8956    10342    +1386     
============================================
  Files           592      698     +106     
  Lines         56313    68326   +12013     
  Branches       5844     7332    +1488     
============================================
+ Hits          26503    31817    +5314     
- Misses        26946    32886    +5940     
- Partials       2864     3623     +759     
Flag Coverage Δ
unittests 46.56% <19.42%> (-0.50%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...apache/bookkeeper/mledger/ManagedLedgerConfig.java 71.60% <0.00%> (ø)
.../org/apache/bookkeeper/mledger/impl/MetaStore.java 100.00% <ø> (ø)
...okkeeper/mledger/impl/ShadowManagedLedgerImpl.java 0.00% <0.00%> (ø)
...kkeeper/mledger/impl/cache/EntryCacheDisabled.java 10.86% <0.00%> (ø)
...ava/org/apache/pulsar/broker/service/Consumer.java 70.28% <0.00%> (+8.18%) :arrow_up:
...ker/stats/prometheus/NamespaceStatsAggregator.java 0.00% <0.00%> (ø)
...va/org/apache/pulsar/client/impl/ProducerImpl.java 17.00% <0.00%> (-0.02%) :arrow_down:
...rg/apache/pulsar/broker/service/BrokerService.java 57.50% <20.00%> (+0.31%) :arrow_up:
...sar/broker/service/persistent/PersistentTopic.java 61.12% <20.00%> (-1.16%) :arrow_down:
...ava/org/apache/pulsar/broker/service/Producer.java 61.75% <27.27%> (-2.15%) :arrow_down:
... and 191 more

codecov-commenter avatar Oct 18 '22 21:10 codecov-commenter

/pulsarbot rerun-failure-checks

poorbarcode avatar Nov 02 '22 04:11 poorbarcode

/pulsarbot rerun-failure-checks

tisonkun avatar Nov 02 '22 06:11 tisonkun