This is an automated email from the ASF dual-hosted git repository.

kfaraz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new f7be683a45c Adjust cost-based autoscaler constant for lag 
multiplication (#19045)
f7be683a45c is described below

commit f7be683a45c36020198520336a26d17d1ba18be7
Author: Sasha Syrotenko <[email protected]>
AuthorDate: Tue Feb 24 11:10:17 2026 +0200

    Adjust cost-based autoscaler constant for lag multiplication (#19045)
---
 .../seekablestream/supervisor/autoscaler/WeightedCostFunction.java  | 6 +++++-
 .../supervisor/autoscaler/WeightedCostFunctionTest.java             | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunction.java
 
b/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunction.java
index 2fbb365fb99..0f5ea6083c7 100644
--- 
a/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunction.java
+++ 
b/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunction.java
@@ -29,7 +29,11 @@ import org.apache.druid.java.util.common.logger.Logger;
 public class WeightedCostFunction
 {
   private static final Logger log = new Logger(WeightedCostFunction.class);
-  private static final double LAG_AMPLIFICATION_MULTIPLIER = 0.2;
+  /**
+   * Multiplier for a lag amplification factor; it was carefully chosen
+   * during extensive testing as the most balanced multiplier for high-lag 
recovery.
+   */
+  static final double LAG_AMPLIFICATION_MULTIPLIER = 0.05;
 
   /**
    * Computes cost for a given task count using compute time metrics.
diff --git 
a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunctionTest.java
 
b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunctionTest.java
index c4d4f493498..c4133c0093b 100644
--- 
a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunctionTest.java
+++ 
b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/WeightedCostFunctionTest.java
@@ -97,7 +97,7 @@ public class WeightedCostFunctionTest
     // aggregateLag = 100000 * 100 = 10,000,000; lagPerPartition = 100,000
     CostMetrics metrics = createMetrics(100000.0, 10, 100, 0.3);
     double aggregateLag = 100000.0 * 100;
-    double amplification = 1.0 + 0.2 * Math.log(aggregateLag / 100);
+    double amplification = 1.0 + 
WeightedCostFunction.LAG_AMPLIFICATION_MULTIPLIER * Math.log(aggregateLag / 
100);
 
     double costCurrent = costFunction.computeCost(metrics, 10, 
lagOnlyConfig).totalCost();
     Assert.assertEquals("Cost of current tasks", aggregateLag * amplification 
/ (10 * 1000.0), costCurrent, 0.1);
@@ -307,7 +307,7 @@ public class WeightedCostFunctionTest
 
     double aggregateLag = 150.0 * partitionCount;
     double lagPerPartition = aggregateLag / partitionCount;
-    double amplification = 1.0 + 0.2 * Math.log(lagPerPartition);
+    double amplification = 1.0 + 
WeightedCostFunction.LAG_AMPLIFICATION_MULTIPLIER * Math.log(lagPerPartition);
     double expected = aggregateLag * amplification / (proposedTaskCount * 
1000.0);
 
     Assert.assertEquals("Lag amplification should increase lag recovery time", 
expected, costWithAmp, 0.0001);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to