summaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java
diff options
context:
space:
mode:
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()