You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/02/01 14:13:05 UTC

[GitHub] [druid] AmatyaAvadhanula opened a new pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

AmatyaAvadhanula opened a new pull request #12221:
URL: https://github.com/apache/druid/pull/12221


   <!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
   
   <!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
   
   Fixes #XXXX.
   
   <!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
   
   <!-- If you are a committer, follow the PR action item checklist for committers:
   https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
   
   ### Description
   
   <!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
   
   <!-- Describe your patch: what did you change in code? How did you fix the problem? -->
   
   <!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
   
   #### Fixed the bug ...
   #### Renamed the class ...
   #### Added a forbidden-apis entry ...
   
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `MyFoo`
    * `OurBar`
    * `TheirBaz`
   
   <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.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] 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


[GitHub] [druid] kfaraz commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
kfaraz commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r797508345



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()
+           >= task.getTaskResource().getRequiredCapacity();
+
+  }
+
+  private int getWorkerParallelIndexCapacity(double parallelIndexWorkerRatio)
+  {
+    int totalCapcity = worker.getCapacity();
+    int workerParallelIndexCapacity = (int) Math.round(parallelIndexWorkerRatio * totalCapcity);
+    if (totalCapcity > 1 && workerParallelIndexCapacity == 0) {

Review comment:
       ```suggestion
       if (workerParallelIndexCapacity < 1) {
   ```
   
   Number of task slots for parallel indexing task should be atleast 1, even if totalCapacity is 1.

##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)

Review comment:
       Nit: Rename to `parallelIndexTaskSlotRatio`

##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/config/WorkerTaskRunnerConfig.java
##########
@@ -26,8 +26,16 @@
   @JsonProperty
   private String minWorkerVersion = "0";
 
+  @JsonProperty
+  private double parallelIndexWorkerRatio = 0.1;

Review comment:
       Nit: Rename to `parallelIndexTaskSlotRatio`




-- 
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


[GitHub] [druid] AmatyaAvadhanula commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
AmatyaAvadhanula commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799903838



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Yes, that could be an issue with the default of 0.1
   
   We could set the default value to 1, in which case the behaviour would be the same as it is today.
   
   A default value of 0.5 might be the best? Deadlocks won't occur and subtask concurrency is not affected except in the cases where a lot of supervising tasks are running
   
   The value can be configured to be lower when supervising tasks are configured to have a lot of subtasks and "fast" progress of a few ingestion tasks is preferred over "slow" progress of all the submitted ones




-- 
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


[GitHub] [druid] loquisgon commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
loquisgon commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r806214015



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Did you look into considering actually have the supervisor task not take any slots? In this way the limiting factor would be the number of sub-tasks allowed but all tasks now are allowed to run with no starvation of any of them (since their supervisor tasks are always allowed to run and their sub-tasks will eventually run when slots free up, assuming that there is already some fairness built in to guarantee older waiting sub-tasks get to run before newer or something like that -- I am not sure that this exists). The potential issue with letting all supervisor run with no task slots taken is that while they don't use a lot of cpu they may use significant memory given that they keep track of the metadata of running sub-tasks, but this can be deal with by adding more memory to the middle managers in case of OOMs.




-- 
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


[GitHub] [druid] loquisgon commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
loquisgon commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799763528



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Will this strategy result in artificially reducing parallel task supervisor concurrency? For example, assume that you have 10 slots and parallelIndexWorkerRatio is 0.1 . Assume that one ingestion is running with one supervisor an one parallel sub task running then if another parallel ingestion is started even though there are 8 slots the new parallel task won't run because the parallel task slots (1) has already been consumed..




-- 
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


[GitHub] [druid] loquisgon commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
loquisgon commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r806214015



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Did you look into considering actually have the supervisor task not take any slots? In this way the limiting factor would be the number of sub-tasks allowed but all tasks now are allowed to run with no starvation of any of them (since their supervisor tasks are always allowed to run and their sub-tasks will eventually run when slots free up, assuming that there is already some fairness built in to guarantee older waiting sub-tasks get to run before newer or something like that -- I am not sure that this exists). The potential issue with letting all supervisor run with no task slots taken is that while they don't use a lot of cpu they may use significant memory given that they keep track of the metadata of running sub-tasks, but this can be deal with by adding more memory to the middle managers in case of OOMs.




-- 
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


[GitHub] [druid] loquisgon commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
loquisgon commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799759150



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()
+           >= task.getTaskResource().getRequiredCapacity();
+
+  }
+
+  private int getWorkerParallelIndexCapacity(double parallelIndexWorkerRatio)
+  {
+    int totalCapcity = worker.getCapacity();
+    int workerParallelIndexCapacity = (int) Math.round(parallelIndexWorkerRatio * totalCapcity);
+    if (totalCapcity > 1 && workerParallelIndexCapacity == 0) {

Review comment:
       Nit: totalCapcity to totalCapacity




-- 
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


[GitHub] [druid] kfaraz merged pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
kfaraz merged pull request #12221:
URL: https://github.com/apache/druid/pull/12221


   


-- 
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


[GitHub] [druid] AmatyaAvadhanula commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
AmatyaAvadhanula commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799903838



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Yes, that could be an issue with the default of 0.1
   
   We could set the default value to 1, in which case the behaviour would be the same as it is today.
   
   A default value of 0.5 might be the best? Deadlocks won't occur and subtask concurrency is not affected except in the cases where there a lot of supervising tasks are running
   
   The value can be configured to be lower when progress supervising tasks are configured to have a lot of subtasks and "fast" progress of a few ingestion tasks is preferred over "slow" progress of all the submitted ones




-- 
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


[GitHub] [druid] kfaraz merged pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
kfaraz merged pull request #12221:
URL: https://github.com/apache/druid/pull/12221


   


-- 
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


[GitHub] [druid] loquisgon commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
loquisgon commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799763528



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Will this strategy result in artificially reducing parallel task supervisor concurrency? For example, assume that you have 10 slots and parallelIndexWorkerRatio is 0.1 . Assume that one ingestion is running with one supervisor and one parallel sub task running then if another parallel ingestion is started even though there are 8 slots the new parallel task won't run because the parallel task slots (1) has already been consumed..




-- 
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


[GitHub] [druid] AmatyaAvadhanula commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
AmatyaAvadhanula commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r799903838



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && !getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - getCurrParallelIndexCapacityUsed()

Review comment:
       Yes, that could be an issue with the default of 0.1
   
   We could set the default value to 1, in which case the behaviour would be the same as it is today.
   
   A default value of 0.5 might be the best? Deadlocks won't occur and subtask concurrency is not affected except in the cases where a lot of supervising tasks are running
   
   The value can be configured to be lower when progress supervising tasks are configured to have a lot of subtasks and "fast" progress of a few ingestion tasks is preferred over "slow" progress of all the submitted ones




-- 
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


[GitHub] [druid] kfaraz commented on a change in pull request #12221: Prevent deadlocks due to multiple parallel indexing tasks

Posted by GitBox <gi...@apache.org>.
kfaraz commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r805755582



##########
File path: docs/configuration/index.md
##########
@@ -1067,6 +1067,7 @@ The following configs only apply if the Overlord is running in remote mode. For
 |--------|-----------|-------|
 |`druid.indexer.runner.taskAssignmentTimeout`|How long to wait after a task as been assigned to a MiddleManager before throwing an error.|PT5M|
 |`druid.indexer.runner.minWorkerVersion`|The minimum MiddleManager version to send tasks to. |"0"|
+| `druid.indexer.runner.parallelIndexTaskSlotRatio`| The ratio of slots available for parallel batch indexing task for each worker.<br/> A value less than 1 when workers are configured to have at least 2 slots can prevent deadlocks.|1|

Review comment:
       ```suggestion
   | `druid.indexer.runner.parallelIndexTaskSlotRatio`| The ratio of task slots available for parallel indexing supervisor tasks per worker. The specified value must be in the range [0, 1].|1|
   ```




-- 
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