Interleave serverless requests across collections - #174
Merged
Conversation
Both `serverless upload` and `serverless query` drained collections sequentially: the whole budget of collection 0, then collection 1, and so on. With bounded parallelism that means only one or two collections ever see concurrent traffic, which is not the multi-collection workload the mode is supposed to produce. Pre-allocate per-collection budgets as before, then drain them in random order (`drain_budgets`) so in-flight requests span many collections while the distribution still comes from the budgets. Sampling while draining is uniform on purpose — the uniform/Zipf skew already lives in the budgets, so re-applying the picker there would skew twice. Query used to pick a collection per request, which made the actual per-collection query counts a random walk rather than the requested distribution; it now walks the same pre-planned batches. Requests are no longer all `batch_size` items, so `Processor` gains `request_count`/`request_size` (defaulting to the old arithmetic) and the progress bar asks the processor instead of assuming a fixed size. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
generall
added a commit
that referenced
this pull request
Sep 3, 2026
Both `serverless upload` and `serverless query` drained collections sequentially: the whole budget of collection 0, then collection 1, and so on. With bounded parallelism that means only one or two collections ever see concurrent traffic, which is not the multi-collection workload the mode is supposed to produce. Pre-allocate per-collection budgets as before, then drain them in random order (`drain_budgets`) so in-flight requests span many collections while the distribution still comes from the budgets. Sampling while draining is uniform on purpose — the uniform/Zipf skew already lives in the budgets, so re-applying the picker there would skew twice. Query used to pick a collection per request, which made the actual per-collection query counts a random walk rather than the requested distribution; it now walks the same pre-planned batches. Requests are no longer all `batch_size` items, so `Processor` gains `request_count`/`request_size` (defaulting to the old arithmetic) and the progress bar asks the processor instead of assuming a fixed size. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.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.
What
serverless uploadandserverless querydrained collections sequentially — the whole budget of collection 0, then collection 1, and so on. With bounded parallelism only one or two collections ever saw concurrent traffic, which isn't the multi-collection workload the mode is meant to produce.drain_budgetsinserverless/distribution.rs: pre-allocate per-collection budgets as before, then emit requests in random order among collections that still have budget. Each collection keeps one contiguous id range, so a dataset source still gives every collection a distinct slice.queryused to pick a collection per request, so actual per-collection query counts were a random walk rather than the requested distribution. It now walks the same pre-planned batches.batch_sizeitems, soProcessorgainsrequest_count/request_size(defaults = the old arithmetic) and the progress bar asks the processor instead of assuming a fixed size.plan_batchesinupload.rsis replaced bydrain_budgets; its test moved over.Checks
devcargo test --all— 176 passedcargo +nightly fmt --allcargo clippy --all --all-features— cleandraining_budgets_preserves_limits_offsets_and_totalscovers per-collection totals, batch cap, and contiguous offsets🤖 Generated with Claude Code