diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-07-14 19:03:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 19:03:17 +0200 |
commit | d782d8e6cd29c30a6639313b29afa46ff6c24514 (patch) | |
tree | ee2d443eb4c4d64530d65bd1d411686886e5854b | |
parent | a54c7d0b87c5b93162b55c151bc9f758e368b9fb (diff) | |
parent | 83c0dacf16c4f7dc818fc6e30cdac6393e0df118 (diff) |
Merge pull request #23513 from vespa-engine/bratseth/make-smaller-changes
Bratseth/make smaller changes
6 files changed, 18 insertions, 9 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 41fa9499353..7fa369da9c6 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 @@ -67,6 +67,7 @@ public class AllocationOptimizer { limits, target, current, clusterModel)); var allocatableResources = AllocatableClusterResources.from(next, current.clusterSpec(), limits, hosts, nodeRepository); + if (allocatableResources.isEmpty()) continue; if (bestAllocation.isEmpty() || allocatableResources.get().preferableTo(bestAllocation.get())) bestAllocation = allocatableResources; 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 c2e66d39861..ed1fbcd3ff8 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 @@ -26,7 +26,7 @@ public class Autoscaler { /** What cost difference is worth a reallocation? */ private static final double costDifferenceWorthReallocation = 0.1; /** What resource difference is worth a reallocation? */ - private static final double resourceDifferenceWorthReallocation = 0.1; + private static final double resourceDifferenceWorthReallocation = 0.03; private final NodeRepository nodeRepository; private final AllocationOptimizer allocationOptimizer; diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java index d750a3ef737..41a23ac21ff 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java @@ -212,12 +212,12 @@ public class Nodes { return setReady(List.of(nodeToReady), agent, reason).get(0); } - /** Reserve nodes. This method does <b>not</b> lock the node repository */ + /** Reserve nodes. This method does <b>not</b> lock the node repository. */ public List<Node> reserve(List<Node> nodes) { return db.writeTo(Node.State.reserved, nodes, Agent.application, Optional.empty()); } - /** Activate nodes. This method does <b>not</b> lock the node repository */ + /** Activate nodes. This method does <b>not</b> lock the node repository. */ public List<Node> activate(List<Node> nodes, NestedTransaction transaction) { return db.writeTo(Node.State.active, nodes, Agent.application, Optional.empty(), transaction); } 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 4140588d1c8..d3142b3cc7f 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 @@ -87,8 +87,6 @@ public class AutoscalingTest { tester.assertResources("Scaling down to minimum since usage has gone down significantly", 7, 1, 1.0, 66.7, 66.7, tester.autoscale(application1, cluster1, capacity)); - - var events = tester.nodeRepository().applications().get(application1).get().cluster(cluster1.id()).get().scalingEvents(); } /** We prefer fewer nodes for container clusters as (we assume) they all use the same disk and memory */ diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java index 94b938fc886..f860b3e5d81 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java @@ -61,9 +61,17 @@ class AutoscalingTester { this(zone, hostResources, null); } + public AutoscalingTester(Zone zone, NodeResources hostResources, int hostCount) { + this(zone, hostResources, null, hostCount); + } + public AutoscalingTester(Zone zone, NodeResources hostResources, HostResourcesCalculator resourcesCalculator) { + this(zone, hostResources, resourcesCalculator, 20); + } + + private AutoscalingTester(Zone zone, NodeResources hostResources, HostResourcesCalculator resourcesCalculator, int hostCount) { this(zone, List.of(new Flavor("hostFlavor", hostResources)), resourcesCalculator); - provisioningTester.makeReadyNodes(20, "hostFlavor", NodeType.host, 8); + provisioningTester.makeReadyNodes(hostCount, "hostFlavor", NodeType.host, 8); provisioningTester.activateTenantHosts(); } @@ -71,8 +79,7 @@ class AutoscalingTester { this(zone, flavors, new MockHostResourcesCalculator(zone)); } - private AutoscalingTester(Zone zone, List<Flavor> flavors, - HostResourcesCalculator resourcesCalculator) { + private AutoscalingTester(Zone zone, List<Flavor> flavors, HostResourcesCalculator resourcesCalculator) { provisioningTester = new ProvisioningTester.Builder().zone(zone) .flavors(flavors) .resourcesCalculator(resourcesCalculator) @@ -377,7 +384,7 @@ class AutoscalingTester { public MetricsDb nodeMetricsDb() { return nodeRepository().metricsDb(); } - private static class MockHostResourcesCalculator implements HostResourcesCalculator { + public static class MockHostResourcesCalculator implements HostResourcesCalculator { private final Zone zone; diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java index 5529f63211d..cee80459176 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java @@ -178,6 +178,9 @@ public class AutoscalingMaintainerTest { } assertEquals(Cluster.maxScalingEvents, tester.cluster(app1, cluster1).scalingEvents().size()); + assertEquals("The latest rescaling is the last event stored", + tester.clock().instant(), + tester.cluster(app1, cluster1).scalingEvents().get(Cluster.maxScalingEvents - 1).at()); } @Test |