diff options
Diffstat (limited to 'node-repository/src/test/java/com')
2 files changed, 103 insertions, 163 deletions
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 1b76f0a36fd..f833348b8dc 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 @@ -5,20 +5,14 @@ import com.yahoo.config.provision.Capacity; import com.yahoo.config.provision.ClusterResources; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.NodeResources; import com.yahoo.config.provision.NodeResources.DiskSpeed; import static com.yahoo.config.provision.NodeResources.DiskSpeed.fast; import static com.yahoo.config.provision.NodeResources.DiskSpeed.slow; import com.yahoo.config.provision.NodeResources.StorageType; -import static com.yahoo.config.provision.NodeResources.StorageType.remote; -import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.Zone; -import com.yahoo.vespa.hosted.provision.NodeRepository; -import com.yahoo.vespa.hosted.provision.Nodelike; import com.yahoo.vespa.hosted.provision.provisioning.CapacityPolicies; -import com.yahoo.vespa.hosted.provision.provisioning.HostResourcesCalculator; import org.junit.Test; import java.time.Duration; @@ -61,63 +55,94 @@ public class AutoscalingTest { /** Using too many resources for a short period is proof we should scale up regardless of the time that takes. */ @Test - public void test_no_autoscaling_with_no_measurements_shared_hosts() { + public void test_no_autoscaling_with_no_measurements() { var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); assertTrue(fixture.autoscale().target().isEmpty()); } /** Using too many resources for a short period is proof we should scale up regardless of the time that takes. */ @Test - public void test_no_autoscaling_with_no_measurements_exclusive_hosts() { + public void test_no_autoscaling_with_no_measurements_exclusive() { var fixture = AutoscalingTester.fixture().awsProdSetup(false).build(); - System.out.println(fixture.autoscale().target()); assertTrue(fixture.autoscale().target().isEmpty()); } /** Using too many resources for a short period is proof we should scale up regardless of the time that takes. */ @Test public void test_autoscaling_up_is_fast() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.loader().applyLoad(new Load(1.0, 1.0, 1.0), 3); fixture.tester().assertResources("Scaling up since resource usage is too high", - 9, 1, 5.3, 15.4, 78.1, + 8, 1, 5.9, 17.7, 89.4, fixture.autoscale()); } /** When scaling up, disregard underutilized dimensions (memory here) */ @Test public void test_only_autoscaling_up_quickly() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.loader().applyLoad(new Load(1.0, 0.1, 1.0), 10); fixture.tester().assertResources("Scaling up (only) since resource usage is too high", - 8, 1, 7.1, 9.1, 89.3, + 8, 1, 7.1, 9.5, 89.4, fixture.autoscale()); } /** When ok to scale down, scale in both directions simultaneously (compare to test_only_autoscaling_up_quickly) */ @Test public void test_scale_in_both_directions_when_ok_to_scale_down() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.tester.clock().advance(Duration.ofDays(2)); fixture.loader().applyLoad(new Load(1.0, 0.1, 1.0), 10); fixture.tester().assertResources("Scaling cpu and disk up and memory down", - 8, 1, 7.1, 4.0, 89.3, + 7, 1, 8.2, 4.0, 104.1, + fixture.autoscale()); + } + + @Test + public void test_scale_in_both_directions_when_ok_to_scale_down_exclusive() { + var fixture = AutoscalingTester.fixture().awsProdSetup(false).build(); + fixture.tester.clock().advance(Duration.ofDays(2)); + fixture.loader().applyLoad(new Load(1.0, 0.1, 1.0), 10); + fixture.tester().assertResources("Scaling cpu and disk up, memory follows", + 16, 1, 4, 8.0, 41.1, fixture.autoscale()); } @Test public void test_autoscaling_uses_peak() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.loader().applyCpuLoad(0.01, 100); fixture.loader().applyCpuLoad(0.70, 1); fixture.loader().applyCpuLoad(0.01, 100); fixture.tester().assertResources("Scaling up since peak resource usage is too high", - 9, 1, 3.8, 8, 37.5, + 9, 1, 3.8, 8.3, 37.7, fixture.autoscale()); } @Test - public void test_autoscaling_without_traffic() { + public void test_autoscaling_uses_peak_exclusive() { + var fixture = AutoscalingTester.fixture().awsProdSetup(false).build(); + fixture.loader().applyCpuLoad(0.01, 100); + fixture.loader().applyCpuLoad(0.70, 1); + fixture.loader().applyCpuLoad(0.01, 100); + fixture.tester().assertResources("Scaling up since peak resource usage is too high", + 10, 1, 4, 8.0, 32.9, + fixture.autoscale()); + } + + @Test + public void test_autoscaling_uses_peak_preprovisioned() { + var fixture = AutoscalingTester.fixture().hostCount(15).build(); + fixture.loader().applyCpuLoad(0.01, 100); + fixture.loader().applyCpuLoad(0.70, 1); + fixture.loader().applyCpuLoad(0.01, 100); + fixture.tester().assertResources("Scaling up since peak resource usage is too high", + 9, 1, 3.8, 8.0, 37.5, + fixture.autoscale()); + } + + @Test + public void test_autoscaling_without_traffic_exclusive() { var min = new ClusterResources(1, 1, new NodeResources(0.5, 4, 10, 0.3)); var now = new ClusterResources(4, 1, new NodeResources(8, 16, 10, 0.3)); var max = new ClusterResources(4, 1, new NodeResources(16, 32, 50, 0.3)); @@ -136,22 +161,22 @@ public class AutoscalingTest { /** We prefer fewer nodes for container clusters as (we assume) they all use the same disk and memory */ @Test public void test_autoscaling_single_container_group() { - var fixture = AutoscalingTester.fixture().hostCount(20).clusterType(ClusterSpec.Type.container).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).clusterType(ClusterSpec.Type.container).build(); fixture.loader().applyCpuLoad(0.25f, 120); ClusterResources scaledResources = fixture.tester().assertResources("Scaling cpu up", - 4, 1, 3.3, 12.8, 60.0, + 4, 1, 3.3, 13.3, 60.3, fixture.autoscale()); fixture.deploy(Capacity.from(scaledResources)); fixture.deactivateRetired(Capacity.from(scaledResources)); fixture.loader().applyCpuLoad(0.1f, 120); fixture.tester().assertResources("Scaling down since cpu usage has gone down", - 3, 1, 2.5, 9.6, 45.0, + 3, 1, 2.5, 10.0, 45.3, fixture.autoscale()); } @Test - public void autoscaling_handles_disk_setting_changes() { + public void autoscaling_handles_disk_setting_changes_exclusive_preprovisioned() { var resources = new NodeResources(3, 100, 100, 1, slow); var fixture = AutoscalingTester.fixture() .hostCount(20) @@ -189,7 +214,7 @@ public class AutoscalingTest { new ClusterResources( 10, 1, resources.with(DiskSpeed.any))); var fixture = AutoscalingTester.fixture() .capacity(capacity) - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.empty()) .build(); @@ -211,7 +236,7 @@ public class AutoscalingTest { var now = new ClusterResources(5, 1, new NodeResources(1.9, 70, 70, 1)); var max = new ClusterResources( 6, 1, new NodeResources(2.4, 78, 79, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)).build(); @@ -226,22 +251,22 @@ public class AutoscalingTest { public void autoscaling_respects_lower_limit() { var min = new ClusterResources( 4, 1, new NodeResources(1.8, 7.4, 8.5, 1)); var max = new ClusterResources( 6, 1, new NodeResources(2.4, 78, 79, 1)); - var fixture = AutoscalingTester.fixture().hostCount(20).capacity(Capacity.from(min, max)).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).capacity(Capacity.from(min, max)).build(); // deploy fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyLoad(new Load(0.05f, 0.05f, 0.05f), 120); fixture.tester().assertResources("Scaling down to limit since resource usage is low", - 4, 1, 1.8, 7.4, 10.4, + 4, 1, 1.8, 7.4, 10.6, fixture.autoscale()); } @Test - public void autoscaling_with_unspecified_resources_use_defaults() { + public void autoscaling_with_unspecified_resources_use_defaults_exclusive() { var min = new ClusterResources( 2, 1, NodeResources.unspecified()); var max = new ClusterResources( 6, 1, NodeResources.unspecified()); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(false) .initialResources(Optional.empty()) .capacity(Capacity.from(min, max)) .build(); @@ -266,21 +291,21 @@ public class AutoscalingTest { var now = new ClusterResources(5, 5, new NodeResources(3.0, 10, 10, 1)); var max = new ClusterResources(18, 6, new NodeResources(100, 1000, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyCpuLoad(0.4, 240); fixture.tester().assertResources("Scaling cpu up", - 6, 6, 5.0, 8.0, 10.0, + 6, 6, 5.0, 8.1, 10.0, fixture.autoscale()); } @Test public void test_autoscaling_limits_when_min_equals_max() { ClusterResources min = new ClusterResources( 2, 1, new NodeResources(1, 1, 1, 1)); - var fixture = AutoscalingTester.fixture().hostCount(20).capacity(Capacity.from(min, min)).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).capacity(Capacity.from(min, min)).build(); // deploy fixture.tester().clock().advance(Duration.ofDays(1)); @@ -289,7 +314,7 @@ public class AutoscalingTest { } @Test - public void container_prefers_remote_disk_when_no_local_match() { + public void container_prefers_remote_disk_when_no_local_match_exclusive() { var resources = new ClusterResources( 2, 1, new NodeResources(3, 100, 50, 1)); var local = new NodeResources(3, 100, 75, 1, fast, StorageType.local); var remote = new NodeResources(3, 100, 50, 1, fast, StorageType.remote); @@ -315,17 +340,28 @@ public class AutoscalingTest { @Test public void suggestions_ignores_limits() { ClusterResources min = new ClusterResources( 2, 1, new NodeResources(1, 1, 1, 1)); - var fixture = AutoscalingTester.fixture().hostCount(20).capacity(Capacity.from(min, min)).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).capacity(Capacity.from(min, min)).build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyCpuLoad(1.0, 120); fixture.tester().assertResources("Suggesting above capacity limit", - 8, 1, 6.2, 7.3, 34.3, + 8, 1, 6.2, 7.6, 34.3, + fixture.tester().suggest(fixture.applicationId, fixture.clusterSpec.id(), min, min)); + } + + @Test + public void suggestions_ignores_limits_exclusive() { + ClusterResources min = new ClusterResources( 2, 1, new NodeResources(1, 1, 1, 1)); + var fixture = AutoscalingTester.fixture().awsProdSetup(false).capacity(Capacity.from(min, min)).build(); + fixture.tester().clock().advance(Duration.ofDays(2)); + fixture.loader().applyCpuLoad(1.0, 120); + fixture.tester().assertResources("Suggesting above capacity limit", + 13, 1, 4, 8, 19.7, fixture.tester().suggest(fixture.applicationId, fixture.clusterSpec.id(), min, min)); } @Test public void not_using_out_of_service_measurements() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyLoad(new Load(0.9, 0.6, 0.7), 1, false, true, 120); assertTrue("Not scaling up since nodes were measured while cluster was out of service", @@ -334,7 +370,7 @@ public class AutoscalingTest { @Test public void not_using_unstable_measurements() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyLoad(new Load(0.9, 0.6, 0.7), 1, true, false, 120); assertTrue("Not scaling up since nodes were measured while cluster was unstable", @@ -347,14 +383,14 @@ public class AutoscalingTest { var now = new ClusterResources(5, 5, new NodeResources(3, 100, 100, 1)); var max = new ClusterResources(20, 20, new NodeResources(10, 1000, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyCpuLoad(0.9, 120); fixture.tester().assertResources("Scaling up to 2 nodes, scaling memory and disk down at the same time", - 10, 5, 7.7, 40.0, 40.0, + 10, 5, 7.7, 40.6, 40.1, fixture.autoscale()); } @@ -364,7 +400,7 @@ public class AutoscalingTest { var now = new ClusterResources(6, 2, new NodeResources(3, 100, 100, 1)); var max = new ClusterResources(21, 7, new NodeResources(100, 1000, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); @@ -373,7 +409,7 @@ public class AutoscalingTest { fixture.tester().clock().advance(timePassed.negated()); fixture.loader().addLoadMeasurements(10, t -> t == 0 ? 20.0 : 10.0, t -> 1.0); fixture.tester().assertResources("Scaling up cpu, others down, changing to 1 group is cheaper", - 10, 1, 2.3, 27.8, 27.8, + 8, 1, 2.8, 36.2, 36, fixture.autoscale()); } @@ -384,7 +420,7 @@ public class AutoscalingTest { var now = new ClusterResources(6, 2, new NodeResources(3, 100, 100, 1)); var max = new ClusterResources(21, 7, new NodeResources(100, 1000, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); @@ -393,7 +429,7 @@ public class AutoscalingTest { fixture.tester().clock().advance(timePassed.negated()); fixture.loader().addLoadMeasurements(10, t -> t == 0 ? 20.0 : 10.0, t -> 100.0); fixture.tester().assertResources("Scaling down since resource usage is too high, changing to 1 group is cheaper", - 6, 1, 1.0, 50.0, 50.0, + 6, 1, 1.0, 50.7, 50.4, fixture.autoscale()); } @@ -403,99 +439,43 @@ public class AutoscalingTest { var now = new ClusterResources(6, 2, new NodeResources(10, 100, 100, 1)); var max = new ClusterResources(30, 30, new NodeResources(100, 100, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); fixture.tester().clock().advance(Duration.ofDays(1)); fixture.loader().applyMemLoad(1.0, 1000); fixture.tester().assertResources("Increase group size to reduce memory load", - 8, 2, 4.5, 96.2, 62.5, + 8, 2, 4.5, 97.1, 62.7, fixture.autoscale()); } @Test - public void autoscaling_avoids_illegal_configurations() { + public void test_autoscaling_memory_down() { var min = new ClusterResources( 2, 1, new NodeResources(1, 1, 1, 1)); var now = new ClusterResources(6, 1, new NodeResources(3, 100, 100, 1)); var max = new ClusterResources(20, 1, new NodeResources(100, 1000, 1000, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .initialResources(Optional.of(now)) .capacity(Capacity.from(min, max)) .build(); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyLoad(new Load(0.16, 0.02, 0.5), 120); - fixture.tester().assertResources("Scaling down", - 6, 1, 3.0, 4.0, 100.0, + fixture.tester().assertResources("Scaling down memory", + 6, 1, 3.0, 4.2, 100.8, fixture.autoscale()); } @Test public void scaling_down_only_after_delay() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.loader().applyCpuLoad(0.02, 120); assertTrue("Too soon after initial deployment", fixture.autoscale().target().isEmpty()); fixture.tester().clock().advance(Duration.ofDays(2)); fixture.loader().applyCpuLoad(0.02, 120); fixture.tester().assertResources("Scaling down since enough time has passed", - 4, 1, 1.0, 17.1, 80.0, - fixture.autoscale()); - } - - @Test - public void test_autoscaling_considers_real_resources() { - { // No memory tax - var fixture = AutoscalingTester.fixture() - .hostCount(20) - .resourceCalculator(new OnlySubtractingWhenForecastingCalculator(0)) - .build(); - fixture.loader().applyLoad(new Load(1.0, 1.0, 0.7), 1000); - fixture.tester().assertResources("Scaling up", - 10, 1, 3.0, 13.7, 48.6, - fixture.autoscale()); - } - - { - var fixture = AutoscalingTester.fixture() - .hostCount(20) - .resourceCalculator(new OnlySubtractingWhenForecastingCalculator(3)) - .build(); - fixture.loader().applyLoad(new Load(1.0, 1.0, 0.7), 1000); - fixture.tester().assertResources("With 3Gb memory tax, we scale up memory more", - 8, 1, 3.7, 20.6, 62.5, - fixture.autoscale()); - } - } - - @Test - public void test_autoscaling_with_dynamic_provisioning() { - ClusterResources min = new ClusterResources( 2, 1, new NodeResources(1, 1, 1, 1)); - ClusterResources max = new ClusterResources(20, 1, new NodeResources(100, 1000, 1000, 1)); - var fixture = AutoscalingTester.fixture() - .dynamicProvisioning(true) - .allowHostSharing(false) - .hostFlavors(new NodeResources(3, 200, 100, 1, fast, remote), - new NodeResources(3, 150, 100, 1, fast, remote), - new NodeResources(3, 100, 100, 1, fast, remote), - new NodeResources(3, 80, 100, 1, fast, remote)) - .capacity(Capacity.from(min, max)) - .initialResources(Optional.of(new ClusterResources(5, 1, - new NodeResources(3, 100, 100, 1)))) - .build(); - - fixture.tester().clock().advance(Duration.ofDays(2)); - fixture.loader().applyMemLoad(0.9, 120); - var scaledResources = fixture.tester().assertResources("Scaling up since resource usage is too high.", - 8, 1, 3, 80, 45.7, - fixture.autoscale()); - fixture.deploy(Capacity.from(scaledResources)); - fixture.deactivateRetired(Capacity.from(scaledResources)); - - fixture.tester().clock().advance(Duration.ofDays(2)); - fixture.loader().applyMemLoad(0.3, 1000); - fixture.tester().assertResources("Scaling down since resource usage has gone down", - 5, 1, 3, 80, 70.0, + 4, 1, 1.0, 17.2, 80.4, fixture.autoscale()); } @@ -504,7 +484,7 @@ public class AutoscalingTest { var min = new ClusterResources( 1, 1, new NodeResources(3, 100, 100, 1)); var max = new ClusterResources(10, 1, new NodeResources(3, 100, 100, 1)); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .awsProdSetup(true) .capacity(Capacity.from(min, max)) .build(); @@ -531,7 +511,7 @@ public class AutoscalingTest { @Test public void test_autoscaling_considers_growth_rate() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.tester().clock().advance(Duration.ofDays(2)); Duration timeAdded = fixture.loader().addLoadMeasurements(100, t -> t == 0 ? 20.0 : 10.0, t -> 0.0); @@ -539,7 +519,7 @@ public class AutoscalingTest { fixture.loader().addCpuMeasurements(0.25, 200); fixture.tester().assertResources("Scale up since we assume we need 2x cpu for growth when no data scaling time data", - 10, 1, 1.2, 5.7, 26.7, + 7, 1, 1.8, 8.9, 40.4, fixture.autoscale()); fixture.setScalingDuration(Duration.ofMinutes(5)); @@ -548,7 +528,7 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.25, 200); fixture.tester().assertResources("Scale down since observed growth is slower than scaling time", - 10, 1, 1.1, 5.7, 26.7, + 7, 1, 1.5, 8.9, 40.4, fixture.autoscale()); fixture.setScalingDuration(Duration.ofMinutes(60)); @@ -559,13 +539,13 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.25, 200); fixture.tester().assertResources("Scale up since observed growth is faster than scaling time", - 10, 1, 1.3, 5.7, 26.7, + 7, 1, 1.8, 8.9, 40.4, fixture.autoscale()); } @Test public void test_autoscaling_considers_query_vs_write_rate() { - var fixture = AutoscalingTester.fixture().hostCount(20).build(); + var fixture = AutoscalingTester.fixture().awsProdSetup(true).build(); fixture.loader().addCpuMeasurements(0.4, 220); @@ -577,7 +557,7 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.4, 200); fixture.tester.assertResources("Query and write load is equal -> scale up somewhat", - 10, 1, 1.4, 5.7, 26.7, + 7, 1, 2, 8.9, 40.2, fixture.autoscale()); fixture.tester().clock().advance(Duration.ofDays(2)); @@ -586,7 +566,7 @@ public class AutoscalingTest { fixture.loader().addCpuMeasurements(0.4, 200); // TODO: Ackhually, we scale down here - why? fixture.tester().assertResources("Query load is 4x write load -> scale up more", - 10, 1, 1.3, 5.7, 26.7, + 7, 1, 1.8, 8.9, 40.4, fixture.autoscale()); fixture.tester().clock().advance(Duration.ofDays(2)); @@ -594,7 +574,7 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.4, 200); fixture.tester().assertResources("Write load is 10x query load -> scale down", - 6, 1, 1.1, 10.2, 48, + 6, 1, 1.1, 10.6, 48.5, fixture.autoscale()); fixture.tester().clock().advance(Duration.ofDays(2)); @@ -602,7 +582,7 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.4, 200); fixture.tester().assertResources("Query only -> largest possible", - 9, 1, 2.7, 6.4, 30, + 7, 1, 3.5, 8.9, 40.2, fixture.autoscale()); fixture.tester().clock().advance(Duration.ofDays(2)); @@ -610,14 +590,14 @@ public class AutoscalingTest { fixture.tester.clock().advance(timeAdded.negated()); fixture.loader().addCpuMeasurements(0.4, 200); fixture.tester().assertResources("Write only -> smallest possible", - 4, 1, 1.1, 17.1, 80, + 4, 1, 1.1, 17.2, 80.4, fixture.autoscale()); } @Test - public void test_autoscaling_in_dev() { + public void test_autoscaling_in_dev_preprovisioned() { var fixture = AutoscalingTester.fixture() - .hostCount(20) + .hostCount(5) .zone(new Zone(Environment.dev, RegionName.from("us-east"))) .build(); fixture.tester().clock().advance(Duration.ofDays(2)); @@ -628,7 +608,7 @@ public class AutoscalingTest { /** Same setup as test_autoscaling_in_dev(), just with required = true */ @Test - public void test_autoscaling_in_dev_with_required_resources() { + public void test_autoscaling_in_dev_with_required_resources_preprovisioned() { var requiredCapacity = Capacity.from(new ClusterResources(2, 1, new NodeResources(1, 1, 1, 1, NodeResources.DiskSpeed.any)), @@ -638,7 +618,7 @@ public class AutoscalingTest { true); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .hostCount(5) .capacity(requiredCapacity) .zone(new Zone(Environment.dev, RegionName.from("us-east"))) .build(); @@ -650,7 +630,7 @@ public class AutoscalingTest { } @Test - public void test_autoscaling_in_dev_with_required_unspecified_resources() { + public void test_autoscaling_in_dev_with_required_unspecified_resources_preprovisioned() { var requiredCapacity = Capacity.from(new ClusterResources(1, 1, NodeResources.unspecified()), new ClusterResources(3, 1, NodeResources.unspecified()), @@ -658,7 +638,7 @@ public class AutoscalingTest { true); var fixture = AutoscalingTester.fixture() - .hostCount(20) + .hostCount(5) .capacity(requiredCapacity) .zone(new Zone(Environment.dev, RegionName.from("us-east"))) .build(); @@ -669,43 +649,4 @@ public class AutoscalingTest { fixture.autoscale()); } - /** - * 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*. - * It is useful here because it ensures that we end up with the same real (and therefore target) - * resources regardless of tax which makes it easier to compare behavior with different tax levels. - */ - private static class OnlySubtractingWhenForecastingCalculator implements HostResourcesCalculator { - - private final int memoryTaxGb; - - public OnlySubtractingWhenForecastingCalculator(int memoryTaxGb) { - this.memoryTaxGb = memoryTaxGb; - } - - @Override - public NodeResources realResourcesOf(Nodelike node, NodeRepository nodeRepository) { - return node.resources(); - } - - @Override - public NodeResources advertisedResourcesOf(Flavor flavor) { - return flavor.resources(); - } - - @Override - public NodeResources requestToReal(NodeResources resources, boolean exclusive) { - return resources.withMemoryGb(resources.memoryGb() - memoryTaxGb); - } - - @Override - public NodeResources realToRequest(NodeResources resources, boolean exclusive) { - return resources.withMemoryGb(resources.memoryGb() + memoryTaxGb); - } - - @Override - public long reservedDiskSpaceInBase2Gb(NodeType nodeType, boolean sharedHost) { return 0; } - - } - } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostResumeProvisionerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostResumeProvisionerTest.java index 64b32276ca2..606e379371a 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostResumeProvisionerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/HostResumeProvisionerTest.java @@ -82,7 +82,6 @@ public class HostResumeProvisionerTest { hostProvisioner.without(MockHostProvisioner.Behaviour.failDnsUpdate); hostResumeProvisioner.maintain(); - provisioning.get().forEach(h -> System.out.println(h.hostname() + " " + h.ipConfig())); assertTrue("IP addresses written as DNS updates are succeeding", provisioning.get().stream().noneMatch(host -> host.ipConfig().pool().ipSet().isEmpty())); } |