[improve] [broker] Improve CPU resources usege of TopicName Cache#23052
[improve] [broker] Improve CPU resources usege of TopicName Cache#23052poorbarcode merged 4 commits intoapache:masterfrom
Conversation
|
/pulsarbot rerun-failure-checks |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23052 +/- ##
============================================
- Coverage 73.57% 73.45% -0.12%
- Complexity 32624 33503 +879
============================================
Files 1877 1915 +38
Lines 139502 143956 +4454
Branches 15299 15727 +428
============================================
+ Hits 102638 105743 +3105
- Misses 28908 30113 +1205
- Partials 7956 8100 +144
Flags with carried forward coverage won't be shown. Click here to find out more.
|
b96dbbd to
e794b67
Compare
|
Here is the benchmark's source code: https://github.com/BewareMyPower/CacheBenchmark A typical output: The overhead for expiration seems significant. @ben-manes @lhotari Please help review if there is something wrong with it. The motivation is that the time cost of parsing a |
|
Thanks! I’ll look later today (it’s late my time). If you are running this on Mac/Windows then reading the current time is a system call, iirc. That’s much slower than a user space call like Linux, so that can artificially skew your results by not being matching the deployment destination. The ticker can be defined if truly necessary to optimize the clock reads. |
3f19821 to
61a7595
Compare
Co-authored-by: Zixuan Liu <nodeces@gmail.com>
The concern is not important, we can impove the code in ther future
|
Since @ben-manes and @lhotari did not answer, let me merge it first. We can improve the code continuously in the future. |
|
Good job! LGTM. |
…ache#23052) Co-authored-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit 81aed6c) (cherry picked from commit 5a83958)
…ache#23052) Co-authored-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit 81aed6c) (cherry picked from commit 5a83958)
…ache#23052) Co-authored-by: Zixuan Liu <nodeces@gmail.com>
…ache (apache#23052)" This reverts commit 81aed6c.
Motivation
LoadableCache.getcost too many CPU resourcesbroker_cpu.html.txt
Modifications
Because there is no need for a strict invalidate time, change the implementation to
ConcurrentHashMap.after_improvement.html
Performance review
Env
master11000topics.110partitioned topic, each partitioned topic contains100partitionspublic/default/{uuid}enableBrokerSideSubscriptionPatternEvaluation:false2.11.41client with220pattern consumers220consumers can put pressure make the broker’s CPU usage to keep 90%16timer task for220consumers ( in default, there is only a single timer for each client )patternAutoDiscoveryPeriodtoseconds, and set it to 1connectionsPerBroker: 100Test cases:
Caffiene Cacheperf_result.zip
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x