-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[improve][broker] PIP-192: Add large topic count filter #19613
[improve][broker] PIP-192: Add large topic count filter #19613
Conversation
@@ -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()) { |
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.
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
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.
Yes, pre-aggregate will be better. Updated.
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.
LGTM, maybe we can name the filter as MaxTopicCountFilter
or BrokerMaxTopicCountFilter
?
Master Issue: #16691
Motivation
We will start raising PRs to implement PIP-192, #16691
Modifications
This PR added a filter that can filter brokers based on the number of topics.
TODO
The broker load data might be delayed, so the max topic check might not be accurate.
Documentation
doc
doc-required
doc-not-needed
doc-complete