kfaraz commented on code in PR #18976: URL: https://github.com/apache/druid/pull/18976#discussion_r2764921770
########## indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/plugins/BurstScaleUpOnHighLagPlugin.java: ########## @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.indexing.seekablestream.supervisor.autoscaler.plugins; + +@SuppressWarnings("ClassCanBeRecord") +public final class BurstScaleUpOnHighLagPlugin +{ + + /** + * Divisor for partition count in the K formula: K = (partitionCount / K_PARTITION_DIVISOR) / sqrt(currentTaskCount). + * This controls how aggressive the scaling is relative to partition count. + * That value was chosen by carefully analyzing the math model behind the implementation. + */ + private static final double K_PARTITION_DIVISOR = 6.4; + + private final int lagThreshold; + + public BurstScaleUpOnHighLagPlugin(int lagThreshold) + { + this.lagThreshold = lagThreshold; + } + + public int lagThreshold() + { + return lagThreshold; + } + + /** + * Computes extra allowed increase in partitions-per-task in scenarios when the average per-partition lag + * is above the configured threshold. + * <p> + * This uses a logarithmic formula for consistent absolute growth: + * {@code deltaTasks = K * ln(lagSeverity)} + * where {@code K = (partitionCount / 6.4) / sqrt(currentTaskCount)} + * <p> + * This ensures: + * 1. Partition-aware scaling: larger datasets get more aggressive scaling. + * 2. Small taskCount's get a massive relative boost, while large taskCount's receive more measured, stable increases. + * 3. Logarithmic lag response: diminishing returns at extreme lag values. + */ + public int computeScaleUpBoost( Review Comment: In the current code flow, this class doesn't really behave very much like a plugin. For the time being, we might as well just move this method to `WeightedCostFunction` since that class has to be aware of the plugin anyway. Once we add the `CostFunction` interface and its implementations, we can move out the method. ########## indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/plugins/OptimalTaskCountBoundariesPlugin.java: ########## @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.indexing.seekablestream.supervisor.autoscaler.plugins; + +/** + * + */ +public class OptimalTaskCountBoundariesPlugin Review Comment: Do you intend to add some methods to this class? ########## docs/ingestion/supervisor.md: ########## @@ -202,13 +202,15 @@ Note: Kinesis is not supported yet, support is in progress. The following table outlines the configuration properties related to the `costBased` autoscaler strategy: -| Property|Description|Required|Default| -|---------|---------------------------------------------------|---|-----| +| Property|Description|Required| Default | +|---------|---------------------------------------------------|---|--| Review Comment: To adhere to the existing style used in the Druid docs: ```suggestion | Property|Description|Required|Default| |---------|-----------|--------|-------| ``` -- 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]
