Azure / Azure/azure-sdk-for-rust

Cosmos: prefetch ORDER BY partition pages concurrently

Open
#4,882 0 comments 1 reaction 0 assignees View on GitHub
Client Cosmos
Dominant language
Rust
Stars
884
Forks
365
Avg merge
2d 19h
Merged PRs (30d)
109

Description

Follow-up from the [#4800](https://github.com/Azure/azure-sdk-for-rust/pull/4800) deep review.

`StreamingOrderedMerge::prime_all_active_children` fetches each partition's head page **serially**, so first-page latency for a cross-partition `ORDER BY` is `partitions × RTT`. On a 20-partition container at 30 ms RTT that is ~600 ms before the first row is emitted, versus ~30 ms if the head pages were fetched concurrently.

.NET and Java both prefetch partition pages in parallel for cross-partition ORDER BY.

### Scope

- Fan out the initial priming pass concurrently (bounded, e.g. by a max-concurrency knob) instead of a sequential `for child in ... { .await }`.
- Consider prefetching the *next* backend page for a child while its buffered rows are still being drained.
- Keep the deterministic merge order and existing split/error semantics unchanged.

### Validation

- Existing `azure_data_cosmos_driver` merge/resume tests stay green.
- A test asserting the mock executor sees overlapping in-flight requests during priming.
- Live/emulator latency comparison on a multi-partition container.

Contributor guide

Open the contributing guide

Research direction

Start at StreamingOrderedMerge::prime_all_active_children and read the merge/resume tests in azure_sdk_cosmos_driver. Run the existing merge/resume tests, then use the mock executor to verify overlapping in-flight requests during initial priming. Done means bounded concurrent prefetching preserves deterministic merge order and existing split/error semantics, with live or emulator latency compared on a multi-partition container.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.