Repository navigation
Use separate executor to handle task updates in TaskQueue - #14533
Conversation
| } | ||
| } | ||
|
|
||
| public CoordinatorRunStats getQueueStats() |
There was a problem hiding this comment.
Hmm. These are not coordinator run stats.
There was a problem hiding this comment.
Yes, I have added a comment in the description of this PR about repurposing the CoordinatorRunStats to be generic DruidStats but that will be tackled in a separate PR.
This class is a nice encapsulation to collect and report stats across multiple dimensions and is thread-safe too.
| // The onSuccess and onFailure should be lightweight enough | ||
| // so that the executor giving the statusFuture is not blocked |
There was a problem hiding this comment.
| // The onSuccess and onFailure should be lightweight enough | |
| // so that the executor giving the statusFuture is not blocked | |
| // The onSuccess and onFailure should be lightweight enough | |
| // so that the executor giving the statusFuture is not blocked | |
| // We use the direct executor here so we can track in-flight status updates. | |
| // so the metrics for in-flight status gets updated immediately. |
There was a problem hiding this comment.
Simplified this comment, added the rest of the info in the javadoc of this method as it seemed like a better place for detailed richer content.
|
Thanks for the review, @abhishekagarwal87 ! |
|
@kfaraz In the release notes, should |
|
Yes, @vtlim , thanks for catching this! |
Description: `TaskQueue.notifyStatus` is often a heavy call as it performs the following operations: - Update task status in metadata DB - Update task locks in metadata DB - Request (synchronously) the task runner to shutdown the completed task - Clean up in-memory data structures This method can often be slow and can cause worker sync / task runners to slow down. Main changes: - Run task completion callbacks in a separate executor to handle task completion updates - Add new config `druid.indexer.queue.taskCompleteHandlerNumThreads` - Add metrics to monitor number of processed and queued items - There are still other paths that can invoke `notifyStatus`, but those need not be moved to the new executor as they are synchronous on purpose. Other changes: - Add new metrics `task/status/queue/count`, `task/status/handled/count` - Add `TaskCountStatsProvider.getStats()` which deprecates the other `getXXXTaskCount` methods. - Use `CoordinatorRunStats` to collect and report metrics. This class has been used as is for now but will later be renamed and repurposed to use across all Druid services.
|
@kfaraz I am wondering if we can instead default this to a percentage of CPU cores on the machine type instead of defaulting it to a value of 5 if the value is not present for taskCompleteHandlerNumThreads? Maybe max 30% of available Runtime.getRuntime().availableProcessors() or 5? This would reduce the amount of configuration a user would have to do on initial setup and id consider this feature a pretty big component for the stability of the overlord when a large number of task statuses are updated. this.taskCompleteHandlerNumThreads = Configs.valueOrDefault(taskCompleteHandlerNumThreads, 5); |
|
@kfaraz Any reason these metrics and config property are not in the docs? I don't think this is internal config and can see users setting these if they are high number of indexing tasks |
|
@maytasm , these were originally meant to be an experimental config and metrics. So we didn't document them originally. Have you encountered cases where the default value of 5 was inadequate? I have personally never had to reconfigure this value or needed to look at the these metrics for any real debugging. I can also implement the suggestion in this comment #14533 (comment) to reduce the config required. Let me know what you think. |
|
@kfaraz Our cluster has about 2500 kafka indexing tasks and 3000 compaction related indexing tasks running. When many tasks roll over at the same time, we saw some issues with the overlord not processing the task updates fast enough. We had instances where it was so slow that we exceeded the completionTimeout on the kafka indexing tasks, causing them to fail. Before trying out this change, we manage it by configuring the stopTaskCount on each supervisor and using taskDuration that are prime numbers (to minimize tasks rolling at the same time). The default value of 5 was inadequate for us. We set the config to be 1/3 of the number of CPU we have (which is about 30) and life has been great. |
|
Sounds good, thanks for the details, @maytasm ! I will create a PR to update the docs. |
Description: `TaskQueue.notifyStatus` is often a heavy call as it performs the following operations: - Update task status in metadata DB - Update task locks in metadata DB - Request (synchronously) the task runner to shutdown the completed task - Clean up in-memory data structures This method can often be slow and can cause worker sync / task runners to slow down. Main changes: - Run task completion callbacks in a separate executor to handle task completion updates - Add new config `druid.indexer.queue.taskCompleteHandlerNumThreads` - Add metrics to monitor number of processed and queued items - There are still other paths that can invoke `notifyStatus`, but those need not be moved to the new executor as they are synchronous on purpose. Other changes: - Add new metrics `task/status/queue/count`, `task/status/handled/count` - Add `TaskCountStatsProvider.getStats()` which deprecates the other `getXXXTaskCount` methods. - Use `CoordinatorRunStats` to collect and report metrics. This class has been used as is for now but will later be renamed and repurposed to use across all Druid services.
Description
TaskQueue.notifyStatusis often a heavy call as it performs the following operations:This method can often be slow and can cause worker sync / task runners to slow down.
Changes
CoordinatorRunStatsto collect and report metrics. This class has been used as is for now but will later be renamed and repurposed across all Druid services.TaskCountStatsProvider.getStats()which deprecates the othergetXXXTaskCountmethods.notifyStatus, but those need not be moved to the new executor as they are synchronous on purpose.Release note
druid.indexer.queue.taskCompleteHandlerNumThreadswhich controls the number of threads used by the OverlordTaskQueueto handle task completion updates received from the workers.task/status/queue/count,task/status/updated/countThis PR has: