perf: bounded concurrent Qdrant setup I/O via buffer_unordered#82
Merged
bashandbone merged 2 commits intoMar 13, 2026
Merged
Conversation
…etup ops Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
recoco-docs | 538324f | Commit Preview URL Branch Preview URL |
Mar 13 2026, 03:39 AM |
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Refactor Qdrant target setup for concurrent async I/O
perf: bounded concurrent Qdrant setup I/O via buffer_unordered
Mar 13, 2026
e2d6086
into
perf/qdrant-setup-concurrency-3772027052885873883
4 checks passed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR bounds concurrent Qdrant collection setup I/O to prevent unbounded request fan-out during delete/create phases while preserving phase ordering.
Changes:
- Introduces
MAX_CONCURRENT_SETUP_OPSand runs setup ops viabuffer_unorderedto cap concurrency. - Adds an invariant comment about
CollectionKeyuniqueness to justify safe intra-phase concurrency. - Reworks delete/create phases to pre-collect futures and then execute them with bounded concurrency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+589
to
596
| for change in setup_change.iter() { | ||
| let client_result = self.get_qdrant_client(&change.key.connection, auth_registry); | ||
| delete_futures.push(async move { | ||
| let client = client_result?; | ||
| change | ||
| .setup_change | ||
| .apply_delete(&change.key.collection_name, &qdrant_client) | ||
| .apply_delete(&change.key.collection_name, &client) | ||
| .await |
Comment on lines
+599
to
+603
| futures::stream::iter(delete_futures) | ||
| .buffer_unordered(MAX_CONCURRENT_SETUP_OPS) | ||
| .try_collect::<Vec<_>>() | ||
| .await | ||
| .map(|_| ())?; |
Comment on lines
+617
to
+621
| futures::stream::iter(create_futures) | ||
| .buffer_unordered(MAX_CONCURRENT_SETUP_OPS) | ||
| .try_collect::<Vec<_>>() | ||
| .await | ||
| .map(|_| ()) |
Comment on lines
+584
to
+585
| // Each item in setup_change has a unique CollectionKey (enforced by the setup | ||
| // orchestration layer), so concurrent operations across items are race-free. |
bashandbone
added a commit
that referenced
this pull request
Mar 13, 2026
* perf: optimize Qdrant target setup by running async I/O concurrently Modified `apply_setup_changes` in `qdrant.rs` to group delete and create operations into separate vectors of futures, running them concurrently via `futures::future::try_join_all`. This fixes an O(N) latency inefficiency where N independent collection changes were awaited sequentially. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> * perf: optimize Qdrant target setup by running async I/O concurrently Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> * perf: bounded concurrent Qdrant setup I/O via buffer_unordered (#82) * Initial plan * perf: replace try_join_all with bounded buffer_unordered for Qdrant setup ops Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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.
The previous
try_join_allrefactor achieved concurrency but with unbounded fan-out — N collections meant N simultaneous Qdrant requests, risking connection storms and server overload. Review feedback requested bounded concurrency, race-condition safety documentation, and reduced duplication.Changes
Bounded concurrency: replaced
try_join_allwithbuffer_unordered(MAX_CONCURRENT_SETUP_OPS)(cap: 16). Futures are pre-collected via aforloop +Vec::with_capacitybefore being streamed — required to satisfyasync_trait's HRTB lifetime constraints, which prevent usingiter().map()directly withbuffer_unordered.Race-condition invariant documented: added a comment confirming
CollectionKeyuniqueness is enforced by the setup orchestration layer, so intra-phase concurrent ops cannot race on the same collection.Constant for the concurrency limit:
MAX_CONCURRENT_SETUP_OPS = 16makes the bound discoverable and easy to tune.Phase ordering (all deletes before any creates) is preserved.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.