Use parallel consumers for bulk import indexing#1039
Open
henrik242 wants to merge 3 commits intokomoot:masterfrom
Open
Use parallel consumers for bulk import indexing#1039henrik242 wants to merge 3 commits intokomoot:masterfrom
henrik242 wants to merge 3 commits intokomoot:masterfrom
Conversation
Use 5 parallel consumer threads for OpenSearch bulk indexing, one per shard. Each thread has its own Importer instance with an independent BulkRequest buffer, sharing the thread-safe OpenSearchClient. Replaces the sentinel-based single-thread shutdown with a volatile flag + poll timeout for clean multi-thread termination. Benchmark (Belgium 11GB, 4.9M docs): 221s -> 166s (25% faster).
otbutz
reviewed
Mar 19, 2026
otbutz
suggested changes
Mar 19, 2026
close() replaces manual shutdown + awaitTermination (Java 19+). The poll timeout only matters for detecting the end of import, so 500ms is plenty.
otbutz
reviewed
Mar 19, 2026
Collaborator
|
Last time I experimented with parallel threads, it resulted in quite noticable index bloat. So, let me test what this does to a planet. The other question I'd have: is there an official recommendation to have as many import threads as shards? Have you tried with more/less threads? |
Contributor
Author
|
@lonvia I tried with various number of threads. Having threadnum=shardnum gave by far the best result. (I have also prepared another commit which depends on this, which gives another 8% improvement) |
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.
Use 5 parallel consumer threads for OpenSearch bulk indexing, one per shard. Each thread has its own Importer instance with an independent BulkRequest buffer, sharing the thread-safe OpenSearchClient.
Replaces the sentinel-based single-thread shutdown with a volatile flag + poll timeout for clean multi-thread termination.
Benchmark (Belgium 11GB, 4.9M docs): 221s -> 166s (25% faster).