You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2022/02/16 01:10:17 UTC

[GitHub] [helix] desaikomal commented on a change in pull request #1961: Use final remaining capacity when computing weighted score

desaikomal commented on a change in pull request #1961:
URL: https://github.com/apache/helix/pull/1961#discussion_r807440651



##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ConstraintBasedAlgorithm.java
##########
@@ -200,14 +196,12 @@ public void computeScore(Map<String, Integer> overallClusterRemainingCapMap) {
       // score = SUM(weight * (resource_capacity/cluster_capacity) where weight = 1/(1-total_util%)
       // it could be be simplified to "resource_capacity/cluster_remainingCapacity".
       for (Map.Entry<String, Integer> resourceCapacity : _replica.getCapacity().entrySet()) {
+        String capacityKey = resourceCapacity.getKey();
         if (resourceCapacity.getValue() == 0) {

Review comment:
       just a suggestion: capacityKey can be moved after == 0 check is done. 
   also clarifying question: if the replica resource capacity required is 0, then do we need to keep that replica entry at all?
   

##########
File path: helix-core/src/test/java/org/apache/helix/controller/rebalancer/waged/constraints/TestConstraintBasedAlgorithm.java
##########
@@ -98,4 +98,24 @@ public void testSortingByResourceCapacity() throws IOException, HelixRebalanceEx
 
     Assert.assertFalse(optimalAssignment.hasAnyFailure());
   }
+
+  // Add capacity related hard/soft constrain to test sorting algorithm in ConstraintBasedAlgorithm.

Review comment:
       nit: constraint 

##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/constraints/ConstraintBasedAlgorithm.java
##########
@@ -70,15 +70,23 @@ public OptimalAssignment calculate(ClusterModel clusterModel) throws HelixRebala
     Set<String> busyInstances =
         getBusyInstances(clusterModel.getContext().getBestPossibleAssignment().values());
 
-    // Compute overall utilization of the cluster. Capacity dimension -> total remaining capacity
-    Map<String, Integer> overallClusterRemainingCapacityMap =
-        computeOverallClusterRemainingCapacity(nodes);
+    for (Map.Entry<String, Integer> clusterRemainingCap : clusterModel.getContext()

Review comment:
       not an expert but AFAIK this can be used using stream/filter.

##########
File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/model/ClusterContext.java
##########
@@ -189,4 +197,17 @@ private float estimateMaxUtilization(Map<String, Integer> totalCapacity,
 
     return estimatedMaxUsage;
   }
+
+  private Map<String, Integer> estimateUtilization(Map<String, Integer> totalCapacity,
+      Map<String, Integer> totalUsage) {
+    Map<String, Integer> estimateUtilization = new HashMap<>();

Review comment:
       just curious - can we not do this instead:
   estimateUtilization = totalcapacity (clone equlvalent)
   for all values in usage, just update the value?  
   




-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org