New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HSEARCH-3084 Initialize and close index managers / backends in parallel #2109
Merged
Conversation
This file contains 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
fax4ever
approved these changes
Oct 2, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
You also improve a lot the existing code!
I've just few marginal doubts on it.
...ava/org/hibernate/search/backend/elasticsearch/index/impl/ElasticsearchIndexManagerImpl.java
Outdated
Show resolved
Hide resolved
...ibernate/search/backend/lucene/orchestration/impl/LuceneReadWorkOrchestratorImplementor.java
Outdated
Show resolved
Hide resolved
...ibernate/search/backend/lucene/orchestration/impl/LuceneReadWorkOrchestratorImplementor.java
Show resolved
Hide resolved
…ng a single REST API call
Necessary because of ES schema validation in particular.
…in Lucene index managers
… started in Lucene index managers
…ntContexts by default
…agers Make sure to always include the shard ID, in particular.
There's no reason to go through an interface exposed in a separate package: the consumer and the implementation of the createWriteOrchestrator() method are located in the same package.
1. Get rid of the Phaser and use much simpler code. 2. Expose a CompletableFuture<?> to wait for full completion (will be useful in the next commits).
Mainly, this means that on shutdown, we'll stop accepting works for all backends/index managers immediately, and *then* we'll wait for ongoing works to complete. The improvement over the previous behavior will probably be negligible, but what's more important is that the path towards an API for explicitly starting/pre-stopping/stopping index managers is now clearer.
It's not a lot, but it's better than nothing.
… a previous workset failed The problem is unrelated to this PR, but was detected thanks to the tests I added to make sure the new implementation works correctly.
Rebased and addressed your comment, thanks! |
Merged, thanks! |
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.
https://hibernate.atlassian.net/browse/HSEARCH-3084
This brings two main changes:
I was hoping that item 1 would improve startup performance with Elasticsearch when there are many indexes, since we would create all indexes in parallel instead of one after another, and each creation takes about 200ms, not counting network latency.
It seems I was wrong: when I test with a single-instance ES cluster, there is absolutely no difference, and when I test with a 5-instance cluster (3 masters, 2 replicas) and 8 indexes, it only takes ~25% less time. I'd have expected something like 80% less.
The problem seems to be that Elasticsearch nodes use some sort of global lock when they create indexes, so even if I send many index creations in parallel, they are executed one after another...
I would be inclined to merge this PR anyway, for these reasons:
BatchingExecutor
class is now much simpler.