summaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2022-08-03 18:17:57 +0200
committerGitHub <noreply@github.com>2022-08-03 18:17:57 +0200
commit8844e681bc04385bde449db144e3306529460265 (patch)
tree2b2a97fbcb486454ba06b2a6cc6224433baeba39 /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
parentfd8261f30845e87b6cc9cb4d09d16e5d2a4f7694 (diff)
parentec4f38324106df044656b4a74fc681d12937f7e3 (diff)
Merge pull request #23574 from vespa-engine/bratseth/autoscale-faster-2v8.29.16
Bratseth/autoscale faster 2
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java17
1 files changed, 10 insertions, 7 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 29f53f0336d..2befd69f893 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
@@ -26,13 +26,13 @@ public class AllocationOptimizer {
}
/**
- * Searches the space of possible allocations given a target
+ * Searches the space of possible allocations given a target relative load
* and (optionally) cluster limits and returns the best alternative.
*
* @return the best allocation, if there are any possible legal allocations, fulfilling the target
* fully or partially, within the limits
*/
- public Optional<AllocatableClusterResources> findBestAllocation(ResourceTarget target,
+ public Optional<AllocatableClusterResources> findBestAllocation(Load targetLoad,
AllocatableClusterResources current,
ClusterModel clusterModel,
Limits limits) {
@@ -51,7 +51,7 @@ public class AllocationOptimizer {
ClusterResources next = new ClusterResources(nodes,
groups,
nodeResourcesWith(nodes, groups,
- limits, target, current, clusterModel));
+ limits, targetLoad, current, clusterModel));
var allocatableResources = AllocatableClusterResources.from(next, current.clusterSpec(), limits,
hosts, nodeRepository);
if (allocatableResources.isEmpty()) continue;
@@ -64,16 +64,19 @@ public class AllocationOptimizer {
/**
* For the observed load this instance is initialized with, returns the resources needed per node to be at
- * ideal load given a target node count
+ * the target relative load, given a target node and group count.
*/
private NodeResources nodeResourcesWith(int nodes,
int groups,
Limits limits,
- ResourceTarget target,
+ Load targetLoad,
AllocatableClusterResources current,
ClusterModel clusterModel) {
- var scaled = clusterModel.loadWith(nodes, groups)
- .scaled(Load.one().divide(clusterModel.redundancyAdjustment()).scaled(target.resources()));
+ var scaled = targetLoad // redundancy aware target relative to current load
+ .multiply(clusterModel.loadWith(nodes, groups)) // redundancy aware adjustment with these counts
+ .divide(clusterModel.redundancyAdjustment()) // correct for double redundancy adjustment
+ .scaled(current.realResources().nodeResources());
+
// Combine the scaled resource values computed here
// with the currently configured non-scaled values, given in the limits, if any
var nonScaled = limits.isEmpty() || limits.min().nodeResources().isUnspecified()