diff options
author | Jon Bratseth <bratseth@vespa.ai> | 2023-07-25 11:39:00 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@vespa.ai> | 2023-07-25 11:39:00 +0200 |
commit | e9c4e69f619cac2399965473aedbfd642ced469a (patch) | |
tree | b7b76bfa47a9f82f0ae38a046a39f1ec88451ea6 /node-repository | |
parent | 6b4d2e073788a6c9340d468302faa75581315095 (diff) |
Cleanup
Diffstat (limited to 'node-repository')
2 files changed, 11 insertions, 10 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java index bbce0442e19..7029991d7bf 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java @@ -90,12 +90,9 @@ public class AllocationOptimizer { Load loadAdjustment, AllocatableClusterResources current, ClusterModel clusterModel) { - var loadWithTarget = loadAdjustment // redundancy adjusted target relative to current load - .multiply(clusterModel.loadWith(nodes, groups)) // redundancy aware adjustment with these counts - .divide(clusterModel.redundancyAdjustment()); // correct for double redundancy adjustment + var loadWithTarget = clusterModel.loadAdjustmentWith(nodes, groups, loadAdjustment); - // Don't scale down all the way to the ideal as that leaves no headroom before needing to scale back up - var oldLoad = loadWithTarget; + // Leave some headroom above the ideal allocation to avoid immediately needing to scale back up if (loadAdjustment.cpu() < 1 && (1.0 - loadWithTarget.cpu()) < headroomRequiredToScaleDown) loadAdjustment = loadAdjustment.withCpu(1.0); if (loadAdjustment.memory() < 1 && (1.0 - loadWithTarget.memory()) < headroomRequiredToScaleDown) @@ -103,11 +100,7 @@ public class AllocationOptimizer { if (loadAdjustment.disk() < 1 && (1.0 - loadWithTarget.disk()) < headroomRequiredToScaleDown) loadAdjustment = loadAdjustment.withDisk(1.0); - loadWithTarget = loadAdjustment // redundancy adjusted target relative to current load - .multiply(clusterModel.loadWith(nodes, groups)) // redundancy aware adjustment with these counts - .divide(clusterModel.redundancyAdjustment()); // correct for double redundancy adjustment - - System.out.println(nodes + " nodes, headroom adjust: " + oldLoad + " -> " + loadWithTarget); + loadWithTarget = clusterModel.loadAdjustmentWith(nodes, groups, loadAdjustment); var scaled = loadWithTarget.scaled(current.realResources().nodeResources()); var nonScaled = limits.isEmpty() || limits.min().nodeResources().isUnspecified() diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java index 61f3dc57d31..0d64d4fbb10 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java @@ -171,6 +171,14 @@ public class ClusterModel { return Duration.ofMinutes(5); } + /** Transforms the given load adjustment to an equivalent adjustment given a target number of nodes and groups. */ + public Load loadAdjustmentWith(int nodes, int groups, Load loadAdjustment) { + return loadAdjustment // redundancy adjusted target relative to current load + .multiply(loadWith(nodes, groups)) // redundancy aware adjustment with these counts + .divide(redundancyAdjustment()); // correct for double redundancy adjustment + } + + /** * Returns the relative load adjustment accounting for redundancy given these nodes+groups * relative to node nodes+groups in this. |