aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-05-13 23:43:23 +0200
committerJon Bratseth <bratseth@gmail.com>2020-05-13 23:43:23 +0200
commit7fc6a4dea4fd58d78230c501b5770182541474ce (patch)
treef339a231d94aa9d7b2b4ddc2eaf6364f95bac67d /node-repository
parenta1d3da1fc3f552ae4e289aba4b0daafa13192536 (diff)
Generalize cpu computation
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java42
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java4
2 files changed, 19 insertions, 27 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 8d26bb89959..0d634823389 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
@@ -128,36 +128,28 @@ 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
*/
- private NodeResources nodeResourcesWith(int nodeCount) {
+ private NodeResources nodeResourcesWith(int nodes) {
+ int groups = singleGroupMode ? 1 : nodes / current.groupSize();
+
// Cpu: Scales with cluster size (TODO: Only reads, writes scales with group size)
// Memory and disk: Scales with group size
-
double cpu, memory, disk;
- if (singleGroupMode) {
- // The fixed cost portion of cpu does not scale with changes to the node count
- // TODO: Only for the portion of cpu consumed by queries
- cpu = fixedCpuCostFraction * target.clusterCpu() / current.groupSize() +
- (1 - fixedCpuCostFraction) * target.clusterCpu() / nodeCount;
-
- if (current.clusterType().isContent()) { // load scales with node share of content
- memory = target.groupMemory() / nodeCount;
- disk = target.groupDisk() / nodeCount;
- }
- else {
- memory = target.nodeMemory();
- disk = target.nodeDisk();
- }
+
+ int groupSize = nodes / groups;
+
+ // The fixed cost portion of cpu does not scale with changes to the node count
+ // TODO: Only for the portion of cpu consumed by queries
+ double cpuPerGroup = fixedCpuCostFraction * target.nodeCpu() +
+ (1 - fixedCpuCostFraction) * target.groupCpu() / groupSize;
+ cpu = cpuPerGroup * current.groups() / groups;
+
+ if (current.clusterType().isContent()) { // load scales with node share of content
+ memory = target.groupMemory() / groupSize;
+ disk = target.groupDisk() / groupSize;
}
else {
- cpu = target.clusterCpu() / nodeCount;
- if (current.clusterType().isContent()) { // load scales with node share of content
- memory = target.groupMemory() / current.groupSize();
- disk = target.groupDisk() / current.groupSize();
- }
- else {
- memory = target.nodeMemory();
- disk = target.nodeDisk();
- }
+ memory = target.nodeMemory();
+ disk = target.nodeDisk();
}
// Combine the scaled resource values computed here
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
index 287cd2ae86a..37f2fa4bf4d 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
@@ -30,8 +30,8 @@ public class ResourceTarget {
/** Are the target resources given by this including redundancy or not */
public boolean adjustForRedundancy() { return adjustForRedundancy; }
- /** Returns the target total cpu to allocate to the entire cluster */
- public double clusterCpu() { return nodeCpu() * current.nodes(); }
+ /** Returns the target total cpu to allocate to each group */
+ public double groupCpu() { return nodeCpu() * current.groupSize(); }
/** Returns the target total memory to allocate to each group */
public double groupMemory() { return nodeMemory() * current.groupSize(); }