diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-08-15 12:02:43 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-08-15 12:02:43 +0200 |
commit | 7d713e1e3c4c5bdb99b8c7abcd862ed202c63d38 (patch) | |
tree | 9b288dc113eae82b7e2d1c6abee077fd1a505b11 /node-repository | |
parent | fbdb7d3b2e03af87e139b39c9e84b85e83dc8bd0 (diff) |
Don't limit averaging period
Diffstat (limited to 'node-repository')
2 files changed, 11 insertions, 14 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java index c739d66a1f0..667846e7b2a 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java @@ -96,15 +96,10 @@ public class ClusterModel { public Load loadAdjustment() { if (nodeTimeseries().measurementsPerNode() == 0) return Load.one(); // No info, no change - System.out.println("Peak " + nodeTimeseries().peakLoad()); - System.out.println("ideal " + idealLoad()); - Load peak = nodeTimeseries().peakLoad().divide(idealLoad()); // Peak relative to ideal - System.out.println("Relative peak " + peak); - if (! safeToScaleDown()) { - peak = peak.map(v -> v < 1 ? 1 : v); - System.out.println(" capped " + peak); - } - return peak; + Load relativePeak = nodeTimeseries().peakLoad().divide(idealLoad()); // Peak relative to ideal + if (! safeToScaleDown()) + relativePeak = relativePeak.map(v -> v < 1 ? 1 : v); + return relativePeak; } /** Are we in a position to make decisions to scale down at this point? */ @@ -142,11 +137,14 @@ public class ClusterModel { return queryFractionOfMax = clusterTimeseries().queryFractionOfMax(scalingDuration(), clock); } - /** Returns average of the last load reading from each node. */ + /** Returns the average of the last load measurement from each node. */ public Load currentLoad() { return nodeTimeseries().currentLoad(); } - /** Returns average load during the last {@link #scalingDuration()} */ - public Load averageLoad() { return nodeTimeseries().averageLoad(clock.instant().minus(scalingDuration())); } + /** Returns the average of all load measurements from all nodes*/ + public Load averageLoad() { return nodeTimeseries().averageLoad(); } + + /** Returns the average of the peak load measurement in each dimension, from each node. */ + public Load peakLoad() { return nodeTimeseries().peakLoad(); } /** The number of nodes this cluster has, or will have if not deployed yet. */ // TODO: Make this the deployed, not current count diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java index ab5be045dd4..24a414a7dd2 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java @@ -59,12 +59,11 @@ public class ClusterNodesTimeseries { public int nodesMeasured() { return timeseries.size(); } /** Returns the average load after the given instant */ - public Load averageLoad(Instant start) { + public Load averageLoad() { Load total = Load.zero(); int count = 0; for (var nodeTimeseries : timeseries) { for (var snapshot : nodeTimeseries.asList()) { - if (snapshot.at().isBefore(start)) continue; total = total.add(snapshot.load()); count++; } |