diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-30 12:54:21 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-30 12:54:21 +0200 |
commit | aa052fd6c6df81f07b8dddf8c139b731a710ade2 (patch) | |
tree | a799dcc313fcaebdd04ea7c16ca34771fac7c220 /node-repository | |
parent | 19af53e11242e39de6ea6df28c7826f61d65e11a (diff) |
Cleanup
Diffstat (limited to 'node-repository')
2 files changed, 12 insertions, 12 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java index 1c3ea55163a..0e4cc8390a2 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java @@ -15,6 +15,11 @@ import java.util.List; */ public class AllocatableClusterResources { + // We only depend on the ratios between these values + private static final double cpuUnitCost = 12.0; + private static final double memoryUnitCost = 1.2; + private static final double diskUnitCost = 0.045; + /** The node count in the cluster */ private final int nodes; @@ -82,7 +87,7 @@ public class AllocatableClusterResources { public int groups() { return groups; } public ClusterSpec.Type clusterType() { return clusterType; } - public double cost() { return nodes * Autoscaler.costOf(advertisedResources); } + public double cost() { return nodes * costOf(advertisedResources); } /** * Returns the fraction measuring how well the real resources fulfils the ideal: 1 means completely fulfiled, @@ -91,6 +96,12 @@ public class AllocatableClusterResources { */ public double fulfilment() { return fulfilment; } + private static double costOf(NodeResources resources) { + return resources.vcpu() * cpuUnitCost + + resources.memoryGb() * memoryUnitCost + + resources.diskGb() * diskUnitCost; + } + private static double fulfilment(NodeResources realResources, NodeResources idealResources) { double vcpuFulfilment = Math.min(1, realResources.vcpu() / idealResources.vcpu()); double memoryGbFulfilment = Math.min(1, realResources.memoryGb() / idealResources.memoryGb()); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java index 1040ffdf0e4..9fe1b4ac55d 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java @@ -42,11 +42,6 @@ public class Autoscaler { /** What difference factor from ideal (for any resource) warrants a change? */ private static final double idealDivergenceWorthReallocation = 0.1; - // We only depend on the ratios between these values - private static final double cpuUnitCost = 12.0; - private static final double memoryUnitCost = 1.2; - private static final double diskUnitCost = 0.045; - private final HostResourcesCalculator resourcesCalculator; private final NodeMetricsDb metricsDb; private final NodeRepository nodeRepository; @@ -195,10 +190,4 @@ public class Autoscaler { return true; } - static double costOf(NodeResources resources) { - return resources.vcpu() * cpuUnitCost + - resources.memoryGb() * memoryUnitCost + - resources.diskGb() * diskUnitCost; - } - } |