315157973 commented on code in PR #17456:
URL: https://github.com/apache/pulsar/pull/17456#discussion_r969827851
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ThresholdShedder.java:
##########
@@ -227,4 +236,59 @@ private double updateAvgResourceUsage(String broker,
LocalBrokerData localBroker
return historyUsage;
}
+ private void tryLowerBoundaryShedding(LoadData loadData,
ServiceConfiguration conf) {
+ // Select the broker with the most resource usage.
+ final double threshold =
conf.getLoadBalancerBrokerThresholdShedderPercentage() / 100.0;
+ final double avgUsage = getBrokerAvgUsage(loadData, conf,
canSampleLog());
+ Pair<Boolean, String> result = getMaxUsageBroker(loadData, threshold,
avgUsage);
+ boolean hasBrokerBelowLowerBound = result.getLeft();
+ String maxUsageBroker = result.getRight();
+ BrokerData brokerData = loadData.getBrokerData().get(maxUsageBroker);
+ if (brokerData == null || brokerData.getLocalData() == null
+ || brokerData.getLocalData().getBundles().size() <= 1) {
+ log.info("Load data is null or bundle <=1, broker name is {},
skipping bundle unload.", maxUsageBroker);
+ return;
+ }
+ if (!hasBrokerBelowLowerBound) {
+ log.info("No broker is below the lower bound, threshold is {}, "
+ + "avgUsage usage is {}, max usage of Broker {} is
{}",
+ threshold, avgUsage, maxUsageBroker,
+ brokerAvgResourceUsage.getOrDefault(maxUsageBroker, 0.0));
+ return;
+ }
+ LocalBrokerData localData = brokerData.getLocalData();
Review Comment:
Why? they look unrelated
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]