summaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-07-18 18:06:37 +0200
committerGitHub <noreply@github.com>2022-07-18 18:06:37 +0200
commit02150a86c5af19cfd88b64cd3b674b0e5ea4349e (patch)
tree8270f775f43271a2f3fc317ce9c46505abca99d5 /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
parent95c483459463add8584d9193a2af16edbd384767 (diff)
parent253cafdebf0f56dfcd5670d78bd4f7ff934b117e (diff)
Merge pull request #23521 from vespa-engine/bratseth/autoscaling-test-cleanupv8.20.14
Bratseth/autoscaling test cleanup
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.java7
1 files changed, 3 insertions, 4 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 7fa369da9c6..5bebd346bdb 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
@@ -57,8 +57,8 @@ public class AllocationOptimizer {
// Adjust for redundancy: Node in group if groups = 1, an extra group if multiple groups
// TODO: Make the best choice based on size and redundancy setting instead
- int nodesAdjustedForRedundancy = target.adjustForRedundancy() ? (groups == 1 ? nodes - 1 : nodes - groupSize) : nodes;
- int groupsAdjustedForRedundancy = target.adjustForRedundancy() ? (groups == 1 ? 1 : groups - 1) : groups;
+ int nodesAdjustedForRedundancy = target.adjustForRedundancy() && nodes > 1 ? (groups == 1 ? nodes - 1 : nodes - groupSize) : nodes;
+ int groupsAdjustedForRedundancy = target.adjustForRedundancy() && nodes > 1 ? (groups == 1 ? 1 : groups - 1) : groups;
ClusterResources next = new ClusterResources(nodes,
groups,
@@ -67,7 +67,6 @@ public class AllocationOptimizer {
limits, target, current, clusterModel));
var allocatableResources = AllocatableClusterResources.from(next, current.clusterSpec(), limits,
hosts, nodeRepository);
-
if (allocatableResources.isEmpty()) continue;
if (bestAllocation.isEmpty() || allocatableResources.get().preferableTo(bestAllocation.get()))
bestAllocation = allocatableResources;
@@ -96,6 +95,7 @@ public class AllocationOptimizer {
// The fixed cost portion of cpu does not scale with changes to the node count
double queryCpuPerGroup = fixedCpuCostFraction * target.resources().vcpu() +
(1 - fixedCpuCostFraction) * target.resources().vcpu() * current.groupSize() / groupSize;
+
double queryCpu = queryCpuPerGroup * current.groups() / groups;
double writeCpu = target.resources().vcpu() * current.groupSize() / groupSize;
cpu = clusterModel.queryCpuFraction() * queryCpu + (1 - clusterModel.queryCpuFraction()) * writeCpu;
@@ -107,7 +107,6 @@ public class AllocationOptimizer {
memory = target.resources().memoryGb();
disk = target.resources().diskGb();
}
-
// Combine the scaled resource values computed here
// with the currently configured non-scaled values, given in the limits, if any
NodeResources nonScaled = limits.isEmpty() || limits.min().nodeResources().isUnspecified()