You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "heesung-sn (via GitHub)" <gi...@apache.org> on 2023/02/27 18:43:27 UTC
[GitHub] [pulsar] heesung-sn commented on a diff in pull request #19613: [improve][broker] PIP-192: Add large topic count filter
heesung-sn commented on code in PR #19613:
URL: https://github.com/apache/pulsar/pull/19613#discussion_r1119150532
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/reporter/BrokerLoadDataReporter.java:
##########
@@ -77,12 +79,18 @@ public BrokerLoadData generateLoadData() {
final var pulsarStats = pulsar.getBrokerService().getPulsarStats();
synchronized (pulsarStats) {
var brokerStats = pulsarStats.getBrokerStats();
+ var bundleStats = pulsarStats.getBundleStats();
+ var topics = 0;
+ for (Map.Entry<String, NamespaceBundleStats> bundleStatsEntry : bundleStats.entrySet()) {
Review Comment:
Can we define `topics` in `BrokerStats` and pre-aggregate this topic counts in `updateStats`?
```
public synchronized void updateStats(
ConcurrentOpenHashMap<String, ConcurrentOpenHashMap<String, ConcurrentOpenHashMap<String, Topic>>>
topicsMap) {
...
bundles.forEach((bundle, topics) -> {
NamespaceBundleStats currentBundleStats = bundleStats.computeIfAbsent(bundle,
k -> new NamespaceBundleStats());
currentBundleStats.reset();
currentBundleStats.topics = topics.size();
brokerStats.topics += topics.size(); //pre-aggregate
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org