heesung-sn commented on code in PR #19154:
URL: https://github.com/apache/pulsar/pull/19154#discussion_r1065026187
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/strategy/LeastResourceUsageWithWeight.java:
##########
@@ -43,21 +41,17 @@ public class LeastResourceUsageWithWeight implements
BrokerSelectionStrategy {
// Maintain this list to reduce object creation.
private final ArrayList<String> bestBrokers;
private final Set<String> noLoadDataBrokers;
- private final Map<String, Double> brokerAvgResourceUsageWithWeight;
public LeastResourceUsageWithWeight() {
this.bestBrokers = new ArrayList<>();
- this.brokerAvgResourceUsageWithWeight = new HashMap<>();
this.noLoadDataBrokers = new HashSet<>();
}
// A broker's max resource usage with weight using its historical load and
short-term load data with weight.
private double getMaxResourceUsageWithWeight(final String broker, final
BrokerLoadData brokerLoadData,
final ServiceConfiguration
conf, boolean debugMode) {
final double overloadThreshold =
conf.getLoadBalancerBrokerOverloadedThresholdPercentage() / 100.0;
- final double maxUsageWithWeight =
- updateAndGetMaxResourceUsageWithWeight(broker, brokerLoadData,
conf, debugMode);
-
+ final var maxUsageWithWeight = brokerLoadData.getWeightedMaxEMA();
Review Comment:
Thanks for this comment.
I changed this `weightedMaxEMA` to 'double` and set the default value to 1.0.
Ideally, the downstream logics using this `BrokerLoadData` should not worry
if it is `updated` or not.
Let's ensure we publish `BrokerLoadData` to the service unit channel only
when it has been `updated` at least once.
Also, accordingly, I cleaned up `BrokerLoadData.`
--
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]