diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-03-09 22:07:09 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-03-09 22:07:09 +0100 |
commit | 4612fe167d9bd72b18336194997e12aa7902b38e (patch) | |
tree | e5962a6972e08d4c92989bcd0e0349c46a2bca20 /node-repository/src | |
parent | c22eee67523c9522c15bb087a738eeb18c457d5c (diff) |
Add some info
Diffstat (limited to 'node-repository/src')
2 files changed, 22 insertions, 4 deletions
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 9794d92b04f..0fc86cf4c5f 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 @@ -95,7 +95,7 @@ public class Autoscaler { if (isDownscaling(bestAllocation.get(), currentAllocation) && scaledIn(scalingWindow.multipliedBy(3), cluster)) return Advice.dontScale("Waiting " + scalingWindow.multipliedBy(3) + " since last rescaling before reducing resources"); - return Advice.scaleTo(bestAllocation.get().advertisedResources()); + return Advice.scaleTo(bestAllocation.get().advertisedResources(), "Limits " + limits + " target " + target); } /** Returns true if both total real resources and total cost are similar */ @@ -180,8 +180,8 @@ public class Autoscaler { private static Advice none(String reason) { return new Advice(Optional.empty(), false, reason); } private static Advice dontScale(String reason) { return new Advice(Optional.empty(), true, reason); } - private static Advice scaleTo(ClusterResources target) { - return new Advice(Optional.of(target), true, "Scaling to " + target + " due to load changes"); + private static Advice scaleTo(ClusterResources target, String message) { + return new Advice(Optional.of(target), true, "Scaling to " + target + " due to load changes: " + message); } @Override diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java index 708316802bd..d0f779a1c8b 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java @@ -519,7 +519,6 @@ public class AutoscalingTest { tester.clearQueryRateMeasurements(application1, cluster1.id()); - System.out.println("The fast growth one"); tester.setScalingDuration(application1, cluster1.id(), Duration.ofMinutes(60)); tester.addQueryRateMeasurements(application1, cluster1.id(), 100, @@ -529,6 +528,25 @@ public class AutoscalingTest { tester.autoscale(application1, cluster1.id(), min, max).target()); } + @Test + public void test_cd_autoscaling_test() { + NodeResources resources = new NodeResources(1, 4, 50, 1); + ClusterResources min = new ClusterResources( 2, 1, resources); + ClusterResources max = new ClusterResources(3, 1, resources); + AutoscalingTester tester = new AutoscalingTester(resources.withVcpu(resources.vcpu() * 2)); + ApplicationId application1 = tester.applicationId("application1"); + ClusterSpec cluster1 = tester.clusterSpec(ClusterSpec.Type.container, "cluster1"); + tester.deploy(application1, cluster1, 2, 1, resources); + + tester.addCpuMeasurements(0.5f, 1f, 10, application1); + tester.addQueryRateMeasurements(application1, cluster1.id(), + 500, t -> 0.5); + + tester.assertResources("Advice to scale up since observed growth is much faster than scaling time", + 3, 1, 1, 4, 50, + tester.autoscale(application1, cluster1.id(), min, max).target()); + } + /** * This calculator subtracts the memory tax when forecasting overhead, but not when actually * returning information about nodes. This is allowed because the forecast is a *worst case*. |