summaryrefslogtreecommitdiffstats
path: root/node-repository/src
diff options
context:
space:
mode:
authorkkraune <kristian@ymail.com>2020-11-06 11:52:54 +0100
committerkkraune <kristian@ymail.com>2020-11-06 11:52:54 +0100
commit382b566c603879349c6edb81765fee062dc6b0d6 (patch)
tree1941ccbeea2598708874faae0d706db10ef39093 /node-repository/src
parent0f9923f99005acd5a46f8aaaa5e60258f396a651 (diff)
add debug logging
Diffstat (limited to 'node-repository/src')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java25
1 files changed, 21 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 e87109200df..5e9b1eb3932 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);
@@ -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());
}