Skip to content

Commit fc9d9f8

Browse files
committed
Improve reasoning for choosing max uptime to weight index contributions to the forecast
1 parent a46ea9b commit fc9d9f8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

x-pack/plugin/write-load-forecaster/src/main/java/org/elasticsearch/xpack/writeloadforecaster/LicensedWriteLoadForecaster.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,13 @@ static OptionalDouble forecastIndexWriteLoad(List<IndexWriteLoad> indicesWriteLo
162162
}
163163
double weightedAverageShardWriteLoad = totalShardWriteLoad / totalShardUptimeInMillis;
164164
double totalIndexWriteLoad = weightedAverageShardWriteLoad * writeLoad.numberOfShards();
165-
// We assume the index shards for a single index lived for approximately the same amount of time,
166-
// so it's safe to weigh the index write load by the max shard uptime
165+
// We need to weight the contribution from each index somehow, but we only know
166+
// the write-load from the final allocation of each shard at rollover time. It's
167+
// possible the index is much older than any of those shards, but we don't have
168+
// any write-load data beyond their lifetime.
169+
// To avoid making assumptions about periods for which we have no data, we'll weight
170+
// each index's contribution to the forecast by the maximum shard uptime observed in
171+
// that index.
167172
allIndicesWriteLoad += totalIndexWriteLoad * maxShardUptimeInMillis;
168173
allIndicesUptime += maxShardUptimeInMillis;
169174
}

0 commit comments

Comments
 (0)