Skip to content

Interleave serverless requests across collections - #174

Merged
generall merged 1 commit into
devfrom
serverless-interleave-collection-requests
Sep 3, 2026
Merged

Interleave serverless requests across collections#174
generall merged 1 commit into
devfrom
serverless-interleave-collection-requests

Conversation

@generall

@generall generall commented Sep 3, 2026

Copy link
Copy Markdown
Member

What

serverless upload and serverless query drained 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.

  • New drain_budgets in serverless/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.
  • Sampling while draining is uniform on purpose — the uniform/Zipf skew already lives in the budgets; re-applying the picker there would skew twice.
  • query used 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.
  • Requests are no longer all batch_size items, so Processor gains request_count/request_size (defaults = the old arithmetic) and the progress bar asks the processor instead of assuming a fixed size.
  • plan_batches in upload.rs is replaced by drain_budgets; its test moved over.

Checks

  • Targets dev
  • cargo test --all — 176 passed
  • cargo +nightly fmt --all
  • cargo clippy --all --all-features — clean
  • New test draining_budgets_preserves_limits_offsets_and_totals covers per-collection totals, batch cap, and contiguous offsets

🤖 Generated with Claude Code

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
generall merged commit 55cd014 into dev Sep 3, 2026
3 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant