Stops listing all compactors in each compactor#4681
Merged
keith-turner merged 2 commits intoapache:2.1from Jun 18, 2024
Merged
Conversation
Each compactor process was listing all other compactors inorder to get a count of compactors. This creates O(N^2) work on zookeeper where N is the number of compactors. This change modifies compactors to get the count from the coordinator via an existing RPC to the coordinator.
ddanielr
approved these changes
Jun 18, 2024
dlmarion
approved these changes
Jun 18, 2024
| printStartupMsg(); | ||
| startCompactionCleaner(schedExecutor); | ||
| startRunningCleaner(schedExecutor); | ||
| // TODO use refresh mechanism to avoid RPCs blocking on getting this count when it expires |
Contributor
There was a problem hiding this comment.
Does this TODO need to be done before the merge?
Contributor
Author
There was a problem hiding this comment.
No, that todo is probably an unneeded optimization that is not supported by any data. I added some logging and removed the todo in 51770be. In testing the log message locally noticed it would take a few ms the first count and 0ms for the 2nd count because its reading from zoocache. Thinking the logging can help if the counts ever turn out to be a problem.
| protected long getWaitTimeBetweenCompactionChecks() { | ||
| protected long getWaitTimeBetweenCompactionChecks(int numCompactors) { | ||
| // get the total number of compactors assigned to this queue | ||
| int numCompactors = ExternalCompactionUtil.countCompactors(queueName, getContext()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each compactor process was listing all other compactors inorder to get a count of compactors. This creates O(N^2) work on zookeeper where N is the number of compactors. This change modifies compactors to get the count from the coordinator via an existing RPC to the coordinator.