You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kfaraz (via GitHub)" <gi...@apache.org> on 2023/08/18 04:42:03 UTC
[PR] Use separate executor for each duty group (druid)
kfaraz opened a new pull request, #14869:
URL: https://github.com/apache/druid/pull/14869
### Motivation
Some coordinator duties such as `CompactSegments` or `KillUnusedSegments` can be slow due to slowness on the Overlord or the metadata store. This causes the coordinator executor to get blocked up thus delaying segment loading and hand-offs, which in turn causes ingestion failures.
With the introduction of custom coordinator duties, it becomes imperative to keep the core coordinator logic always unblocked.
### Changes
- Use separate executor for every duty group
- This change is thread-safe as every duty group uses its own copy of `DruidCoordinatorRuntimeParams` and does not share any other mutable instances with other duty groups.
- With the exception of `HistoricalManagementDuties`, duty groups are typically not very compute intensive and mostly perform database or HTTP I/O. So, coordinator resources would still mostly be available for `HistoricalManagementDuties`.
### Alternative approach
Have 1 executor for `HistoricalManagementDuties` and 1 for all other duty groups.
However, this still allows users to schedule some custom duties that compete with say the `IndexingServiceDuties` or `MetadataStoreManagementDuties`.
---
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.
- [ ] 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] Use separate executor for each coordinator duty group (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #14869:
URL: https://github.com/apache/druid/pull/14869#discussion_r1299865521
##########
server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java:
##########
@@ -395,7 +396,7 @@ public void stop()
started = false;
- exec.shutdownNow();
+ stopAllDutyGroupExecutors();
Review Comment:
No, duties do not run and metrics are not emitted if the coordinator is not leader.
See https://github.com/apache/druid/blob/3a75ee2098390922501e0993b8c29e9a85c42b3b/server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java#L508-L515
But I guess it is better to call `stopAllDutyGroupExecutors` in `stopBeingLeader` itself.
I don't want to run the whole CI just for this as it doesn't really make a difference. I will address it in a follow up PR, unless there are other comments in the current PR.
--
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] Use separate executor for each coordinator duty group (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #14869:
URL: https://github.com/apache/druid/pull/14869#discussion_r1299848759
##########
server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java:
##########
@@ -395,7 +396,7 @@ public void stop()
started = false;
- exec.shutdownNow();
+ stopAllDutyGroupExecutors();
Review Comment:
Why is this called when the lifecycle stops and not immediately when the coordinator stops being the leader?
If the executors have scheduled long running duties, could it perform duties and emit related metrics such as coordinator/time even after it has stopped being the leader?
--
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] Use separate executor for each coordinator duty group (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #14869:
URL: https://github.com/apache/druid/pull/14869#discussion_r1299871334
##########
server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java:
##########
@@ -395,7 +396,7 @@ public void stop()
started = false;
- exec.shutdownNow();
+ stopAllDutyGroupExecutors();
Review Comment:
Sorry, I meant to ask about (long running) duties that had already been scheduled and are waiting to be run.
+1 from me as I have no other comments
--
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] Use separate executor for each coordinator duty group (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #14869:
URL: https://github.com/apache/druid/pull/14869#discussion_r1299918804
##########
server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java:
##########
@@ -395,7 +396,7 @@ public void stop()
started = false;
- exec.shutdownNow();
+ stopAllDutyGroupExecutors();
Review Comment:
Yes, a duty group which has been scheduled for later will not run either.
https://github.com/apache/druid/blob/3a75ee2098390922501e0993b8c29e9a85c42b3b/server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java#L701-L704
A duty group which has already started will not run any more duties after the currently running one has finished.
https://github.com/apache/druid/blob/3a75ee2098390922501e0993b8c29e9a85c42b3b/server/src/main/java/org/apache/druid/server/coordinator/DruidCoordinator.java#L747-L749
--
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] Use separate executor for each coordinator duty group (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #14869:
URL: https://github.com/apache/druid/pull/14869#issuecomment-1686057155
Thanks for the reviews, @findingrish , @AmatyaAvadhanula !
--
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] Use separate executor for each coordinator duty group (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #14869:
URL: https://github.com/apache/druid/pull/14869
--
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