aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-02-20 13:06:39 +0100
committerJon Bratseth <bratseth@gmail.com>2023-02-20 13:06:39 +0100
commit2305c5802f887edafd1a1351f6ef797d0509b416 (patch)
tree3bdd748ea6a62b8ae8bb8df86bdbbdbc6fd2338f
parenta5d5a7dd7bab499554691fa59e08b3771b5e32d3 (diff)
Get by with less measurements
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterNodesTimeseries.java35
1 files changed, 4 insertions, 31 deletions
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 b86a24af5c9..0be4175c2c1 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
@@ -28,10 +28,10 @@ public class ClusterNodesTimeseries {
public ClusterNodesTimeseries(Duration period, Cluster cluster, NodeList clusterNodes, MetricsDb db) {
this.clusterNodes = clusterNodes;
- // See warmupSeconds*4 into the past to see any generation change in it
+ // See warmupDuration*4 into the past to see any generation change in it.
// If none can be detected we assume the node is new/was down.
// If either this is the case, or there is a generation change, we ignore
- // the first warmupWindow metrics
+ // the first warmupWindow metrics.
var timeseries = db.getNodeTimeseries(period.plus(warmupDuration.multipliedBy(4)), clusterNodes);
if (cluster.lastScalingEvent().isPresent()) {
long currentGeneration = cluster.lastScalingEvent().get().generation();
@@ -52,42 +52,15 @@ public class ClusterNodesTimeseries {
}
/** Returns the average number of measurements per node */
- public int measurementsPerNode() {
+ public double measurementsPerNode() {
if (clusterNodes.size() == 0) return 0;
int measurementCount = timeseries.stream().mapToInt(m -> m.size()).sum();
- return measurementCount / clusterNodes.size();
+ return (double)measurementCount / clusterNodes.size();
}
/** Returns the number of nodes measured in this */
public int nodesMeasured() { return timeseries.size(); }
- /** Returns the average load after the given instant */
- public Load averageLoad() {
- Load total = Load.zero();
- int count = 0;
- for (var nodeTimeseries : timeseries) {
- for (var snapshot : nodeTimeseries.asList()) {
- total = total.add(snapshot.load());
- count++;
- }
- }
- return total.divide(count);
- }
-
- /** Returns average of the latest load reading from each node */
- public Load currentLoad() {
- Load total = Load.zero();
- int count = 0;
- for (var nodeTimeseries : timeseries) {
- Optional<NodeMetricSnapshot> last = nodeTimeseries.last();
- if (last.isEmpty()) continue;
-
- total = total.add(last.get().load());
- count++;
- }
- return total.divide(count);
- }
-
/**
* Returns the "peak load" in this: Which is for each load dimension,
* the average of the highest reading for that dimension on each node.