summaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-11-06 13:35:10 +0100
committerGitHub <noreply@github.com>2020-11-06 13:35:10 +0100
commit58b015f069738f90f6f01b9c728f831d13dfc4f2 (patch)
tree838b7b9085c124237ac94c947ce4a3f38620a5d4 /node-repository
parent4401b9e45d9de4b39cd5c316e2b51aaa4e8f9969 (diff)
parent382b566c603879349c6edb81765fee062dc6b0d6 (diff)
Merge pull request #15209 from vespa-engine/kkraune/autoscale-debug
Kkraune/autoscale debug
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java25
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java3
2 files changed, 23 insertions, 5 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 0db4c37b154..6e7be8f5672 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
@@ -10,6 +10,7 @@ import com.yahoo.vespa.hosted.provision.applications.Cluster;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
+import java.util.logging.Logger;
/**
* The autoscaler makes decisions about the flavor and node count that should be allocated to a cluster
@@ -19,6 +20,8 @@ import java.util.Optional;
*/
public class Autoscaler {
+ protected final Logger log = Logger.getLogger(this.getClass().getName());
+
/** What cost difference factor is worth a reallocation? */
private static final double costDifferenceWorthReallocation = 0.1;
/** What difference factor for a resource is worth a reallocation? */
@@ -57,7 +60,12 @@ public class Autoscaler {
}
private Advice autoscale(Cluster cluster, List<Node> clusterNodes, Limits limits, boolean exclusive) {
- if (unstable(clusterNodes, nodeRepository)) return Advice.none();
+ log.fine(() -> "Autoscale " + cluster.toString());
+
+ if (unstable(clusterNodes, nodeRepository)) {
+ log.fine(() -> "Unstable - Advice.none " + cluster.toString());
+ return Advice.none();
+ }
AllocatableClusterResources currentAllocation = new AllocatableClusterResources(clusterNodes, nodeRepository, cluster.exclusive());
@@ -66,13 +74,22 @@ public class Autoscaler {
Optional<Double> cpuLoad = clusterTimeseries.averageLoad(Resource.cpu);
Optional<Double> memoryLoad = clusterTimeseries.averageLoad(Resource.memory);
Optional<Double> diskLoad = clusterTimeseries.averageLoad(Resource.disk);
- if (cpuLoad.isEmpty() || memoryLoad.isEmpty() || diskLoad.isEmpty()) return Advice.none();
+ if (cpuLoad.isEmpty() || memoryLoad.isEmpty() || diskLoad.isEmpty()) {
+ log.fine(() -> "Missing average load - Advice.none " + cluster.toString());
+ return Advice.none();
+ }
var target = ResourceTarget.idealLoad(cpuLoad.get(), memoryLoad.get(), diskLoad.get(), currentAllocation);
Optional<AllocatableClusterResources> bestAllocation =
allocationOptimizer.findBestAllocation(target, currentAllocation, limits, exclusive);
- if (bestAllocation.isEmpty()) return Advice.dontScale();
- if (similar(bestAllocation.get(), currentAllocation)) return Advice.dontScale();
+ if (bestAllocation.isEmpty()) {
+ log.fine(() -> "bestAllocation.isEmpty - Advice.dontScale " + cluster.toString());
+ return Advice.dontScale();
+ }
+ if (similar(bestAllocation.get(), currentAllocation)) {
+ log.fine(() -> "Current allocation similar - Advice.dontScale " + cluster.toString());
+ return Advice.dontScale();
+ }
return Advice.scaleTo(bestAllocation.get().toAdvertisedClusterResources());
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
index f7e2283dd95..3659ffd6b47 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
@@ -17,6 +17,7 @@ import com.yahoo.vespa.hosted.provision.autoscale.MetricsDb;
import java.time.Duration;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -94,7 +95,7 @@ public class AutoscalingMaintainer extends NodeRepositoryMaintainer {
}
static String toString(ClusterResources r) {
- return String.format("%d%s * [vcpu: %.1f, memory: %.1f Gb, disk %.1f Gb]" +
+ return String.format(Locale.US, "%d%s * [vcpu: %.1f, memory: %.1f Gb, disk %.1f Gb]" +
" (total: [vcpu: %.1f, memory: %.1f Gb, disk: %.1f Gb])",
r.nodes(), r.groups() > 1 ? " (in " + r.groups() + " groups)" : "",
r.nodeResources().vcpu(), r.nodeResources().memoryGb(), r.nodeResources().diskGb(),