Fly-Style commented on code in PR #19687:
URL: https://github.com/apache/druid/pull/19687#discussion_r3645629374
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java:
##########
@@ -644,6 +648,80 @@ public boolean isAnotherTaskGroupPublishingToPartitions(
}
}
+ /**
+ * Simulates the effects of the {@code costBased} auto-scaler by computing
the optimal
+ * task count under various values of aggregate lag.
+ */
+ public Map<String, Object> simulateAutoscaling(
+ String supervisorId,
+ CostBasedAutoScalerConfig config,
+ int criticalLag,
+ int maxProcessingRatePerTask,
+ @Nullable Integer requestedTaskCount
+ )
+ {
+ // Validate that this is a streaming supervisor
+ final StreamSupervisor supervisor = requireStreamSupervisor(supervisorId,
"simulateAutoscaling");
+
+ // Validate the inputs
+ InvalidInput.conditionalException(
+ criticalLag >= 1000,
+ "Value of critical lag[%d] must be 1000 or more",
+ criticalLag
+ );
+ InvalidInput.conditionalException(
+ maxProcessingRatePerTask >= 100,
+ "Value of maxProcessingRatePerTask[%d] must be 100 events per second
or more",
+ maxProcessingRatePerTask
+ );
+
+ // Simulate from the supervisor's live task count unless the caller pins
one.
+ final int currentTaskCount = Configs.valueOrDefault(
+ requestedTaskCount,
+ ((SeekableStreamSupervisor<?, ?, ?>)
supervisor).getIoConfig().getTaskCount()
+ );
+ InvalidInput.conditionalException(
+ requestedTaskCount == null
+ || (currentTaskCount >= config.getTaskCountMin() && currentTaskCount
<= config.getTaskCountMax()),
+ "Value of currentTaskCount[%d] must be within taskCountMin[%d] and
taskCountMax[%d]",
+ currentTaskCount, config.getTaskCountMin(), config.getTaskCountMax()
+ );
+ final int simulationTaskCount = Math.max(
+ config.getTaskCountMin(),
+ Math.min(currentTaskCount, config.getTaskCountMax())
+ );
+
+ // Assumption: enough partitions to reach taskCountMax.
+ final int partitionCount = config.getTaskCountMax();
Review Comment:
It is under user control; let them play.
--
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]