diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-05-15 16:03:29 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-05-15 16:03:29 +0200 |
commit | c9cb1ee32a445d8ba76d3f3657544f9395d499c6 (patch) | |
tree | c862782a97a0db62919fa9e6b246a5bef85e55ee /node-repository | |
parent | efe3e94f0ac662fd6b3486e7a7037d35bf663c9c (diff) |
Simplify
Diffstat (limited to 'node-repository')
2 files changed, 8 insertions, 25 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 aaaa183fd23..0f8fe1e343a 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 @@ -141,10 +141,10 @@ public class AllocationOptimizer { // 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; + (1 - fixedCpuCostFraction) * target.nodeCpu() * current.groupSize() / groupSize; cpu = cpuPerGroup * current.groups() / groups; - memory = target.groupMemory() / groupSize; - disk = target.groupDisk() / groupSize; + memory = target.nodeMemory() * current.groupSize() / groupSize; + disk = target.nodeDisk() * current.groupSize() / groupSize; } else { cpu = target.nodeCpu() * current.nodes() / nodes; 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 37f2fa4bf4d..eff71556e78 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 @@ -1,11 +1,11 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.provision.autoscale; -import com.yahoo.config.provision.NodeResources; - /** * A resource target to hit for the allocation optimizer. * The target is measured in cpu, memory and disk per node in the allocation given by current. + * + * @author bratseth */ public class ResourceTarget { @@ -14,31 +14,16 @@ public class ResourceTarget { /** The target resources per node, assuming the node assignment in current */ private final double cpu, memory, disk; - /** The current allocation leading to this target */ - private final AllocatableClusterResources current; - - private ResourceTarget(double cpu, double memory, double disk, - boolean adjustForRedundancy, - AllocatableClusterResources current) { + private ResourceTarget(double cpu, double memory, double disk, boolean adjustForRedundancy) { this.cpu = cpu; this.memory = memory; this.disk = disk; this.adjustForRedundancy = adjustForRedundancy; - this.current = current; } /** Are the target resources given by this including redundancy or not */ public boolean adjustForRedundancy() { return adjustForRedundancy; } - /** 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(); } - - /** Returns the target total disk to allocate to each group */ - public double groupDisk() { return nodeDisk() * current.groupSize(); } - /** Returns the target cpu per node, in terms of the current allocation */ public double nodeCpu() { return cpu; } @@ -58,8 +43,7 @@ public class ResourceTarget { return new ResourceTarget(nodeUsage(Resource.cpu, currentCpuLoad, current) / Resource.cpu.idealAverageLoad(), nodeUsage(Resource.memory, currentMemoryLoad, current) / Resource.memory.idealAverageLoad(), nodeUsage(Resource.disk, currentDiskLoad, current) / Resource.disk.idealAverageLoad(), - true, - current); + true); } /** Crete a target of preserving a current allocation */ @@ -67,8 +51,7 @@ public class ResourceTarget { return new ResourceTarget(current.realResources().vcpu(), current.realResources().memoryGb(), current.realResources().diskGb(), - false, - current); + false); } } |