You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "capistrant (via GitHub)" <gi...@apache.org> on 2026/06/04 22:26:55 UTC

[PR] Make segmentLoadAheadCount able to be configured at worker task level in addition to context (druid)

capistrant opened a new pull request, #19559:
URL: https://github.com/apache/druid/pull/19559

   ### Description
   
   Allow configuring `segmentLoadAheadCount` for dart workers via local runtime property. This unlocks flexibility in situations where you do not want to rely on a controller provided context value to control this property. It can be powerful in situations where you deploy multiple tiers of historicals on disperate hardware, and would like to customize the value to maximize a given hardware spec's capabilities. unset by default, which maintains behavior that already exists - the controller provided context provides the value OR a default `2 * threads` is used.
   
   
   #### Release note
   
   Add dart worker runtime property `druid.msq.dart.worker.segmentLoadAheadCount` to allow worker local configuration of `segmentLoadAheadCount`. If configured to be `> 0` for a worker, this becomes the default `segmentLoadAheadCount` value for the worker.  If the controller also sends `segmentLoadAheadCount` in the context, the larger one is picked. If not set, the worker will either use the controller provided context value or the default `2 * threads` if nothing is set in context.
   
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `DartWorkerConfig`
    * `DartWorkerContext`
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] feat: Make segmentLoadAheadCount able to be configured at worker task level in addition to context (druid)

Posted by "capistrant (via GitHub)" <gi...@apache.org>.
capistrant commented on code in PR #19559:
URL: https://github.com/apache/druid/pull/19559#discussion_r3363403816


##########
multi-stage-query/src/main/java/org/apache/druid/msq/dart/guice/DartWorkerConfig.java:
##########
@@ -41,6 +44,22 @@ public class DartWorkerConfig
   @JsonProperty("heapFraction")
   private double heapFraction = DEFAULT_HEAP_FRACTION;
 
+  /**
+   * Worker-local value for the segment load-ahead count used to size segment prefetch in {@link ReadableInputQueue}.
+   * <p>
+   * Defaults to null (unset), which leaves the value to query context (client or controller-default supplied) and the
+   * built-in {@code 2 * threadCount} fallback. When set to a positive value, it acts as a worker-local floor: the
+   * effective count becomes the larger of this value and any value present in the query context, so a query can still

Review Comment:
   fair point, I can make this switch to the selection precedence



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] feat: Make segmentLoadAheadCount able to be configured at worker task level in addition to context (druid)

Posted by "capistrant (via GitHub)" <gi...@apache.org>.
capistrant merged PR #19559:
URL: https://github.com/apache/druid/pull/19559


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] feat: Make segmentLoadAheadCount able to be configured at worker task level in addition to context (druid)

Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on code in PR #19559:
URL: https://github.com/apache/druid/pull/19559#discussion_r3359271863


##########
multi-stage-query/src/main/java/org/apache/druid/msq/dart/guice/DartWorkerConfig.java:
##########
@@ -41,6 +44,22 @@ public class DartWorkerConfig
   @JsonProperty("heapFraction")
   private double heapFraction = DEFAULT_HEAP_FRACTION;
 
+  /**
+   * Worker-local value for the segment load-ahead count used to size segment prefetch in {@link ReadableInputQueue}.
+   * <p>
+   * Defaults to null (unset), which leaves the value to query context (client or controller-default supplied) and the
+   * built-in {@code 2 * threadCount} fallback. When set to a positive value, it acts as a worker-local floor: the
+   * effective count becomes the larger of this value and any value present in the query context, so a query can still

Review Comment:
   I think it would be better to use the value from the query context as-is, if it is provided. That way the query context can more easily be used for experimentation and temporary tuning, in either direction.



##########
multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerContext.java:
##########
@@ -148,6 +157,9 @@ public class DartWorkerContext implements WorkerContext
     final int baseThreadCount = processingConfig.getNumThreads();
     final Integer maxThreads = MultiStageQueryContext.getMaxThreads(queryContext);
     this.threadCount = (maxThreads != null && maxThreads > 0) ? Math.min(baseThreadCount, maxThreads) : baseThreadCount;
+
+    // Worker-local segment load-ahead config, read once from this worker's DartWorkerConfig.
+    this.segmentLoadAheadCountConfig = injector.getInstance(DartWorkerConfig.class).getSegmentLoadAheadCount();

Review Comment:
   Probably better to not use the injector so explicitly here. It would be more aligned to do it like the other stuff in this constructor, which is injected into `DartWorkerContextFactoryImpl` and then passed through.



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org