jtuglu1 commented on code in PR #19286:
URL: https://github.com/apache/druid/pull/19286#discussion_r3119817901
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -513,45 +537,59 @@ public void handle()
dataSource,
list
);
- if (desiredTaskCount > 0) {
- emitter.emit(event.setDimension(
- AUTOSCALER_SKIP_REASON_DIMENSION,
- "There are tasks pending completion"
- )
- .setMetric(AUTOSCALER_REQUIRED_TASKS_METRIC,
desiredTaskCount));
- }
+ emitter.emit(event.setDimension(
+ AUTOSCALER_SKIP_REASON_DIMENSION,
+ "There are tasks pending completion"
+ )
+ .setMetric(AUTOSCALER_REQUIRED_TASKS_METRIC,
desiredTaskCount));
return;
}
}
- if (nowTime - dynamicTriggerLastRunTime <
autoScalerConfig.getMinTriggerScaleActionFrequencyMillis()) {
+
+ // 3) Make sure we are not breaching any scaling cooldown limits.
+ // Scaling operations are disruptive — scale-down in particular can
leave the supervisor
+ // under-resourced while it recovers from lag induced by the scale
event, so callers may
+ // configure a longer cooldown for scale-down than for scale-up.
Both directions are measured against the same
+ // last-scale timestamp so that a rapid up/down oscillation is still
subject to the appropriate cooldown,
+ // regardless of which direction triggered last.
+ final ScaleDirection scaleDirection;
+ final long cooldownMillis;
+
+ if (desiredTaskCount > currentTaskCount) {
+ scaleDirection = ScaleDirection.SCALE_UP;
+ cooldownMillis = autoScalerConfig.getMinScaleUpDelay().getMillis();
+ } else { // desiredTaskCount < currentTaskCount
+ scaleDirection = ScaleDirection.SCALE_DOWN;
+ cooldownMillis =
autoScalerConfig.getMinScaleDownDelay().getMillis();
+ }
Review Comment:
These scale up/down fields default to `minTriggerScaleActionFrequencyMillis`
if not already set, which itself defaults to 60s. It is there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]