Skip to content

perf(cloudfetch): request chunks ahead of body admission - #508

Draft
vuanhphung wants to merge 1 commit into
mainfrom
perf/cf-ahead
Draft

vuanhphung wants to merge 1 commit into
mainfrom
perf/cf-ahead

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

Description

CloudFetch holds a window slot until a decoded chunk is consumed. Per-chunk traces show completed chunks sitting unread while download concurrency falls below the configured window. On the live pecotesting 1GB label (105 chunks), bounded request-ahead reduces native Rust drain latency without enlarging the decoded chunk window.

Send a bounded number of extra GETs, deferring body collection until window admission. Admission waiting does not spend the normal download budget; changed/expired links and closed idle responses fall back safely. cloudfetch_download_ahead is opt-in (0–16); explicit zero overrides the proposed, unprovisioned int32 flag databricks.partnerplatform.clientConfigsFeatureFlags.cloudFetchDownloadAheadForKernel. Missing flag means zero. Default enablement remains a user decision because socket memory and RSS increase. This shares the core path across bindings and does not change HTTP client construction (#488) or SEA close handling (#459/#472).

Testing

92 CloudFetch tests pass, including nullable values, ordering/limits, bounded admission, slow consumers, URL refresh, idle sockets and cancellation. Full checks, live edge cases and Python confirmation are in progress; this PR remains a draft.

Five fresh-process interleaved live pairs, excluded warmup, 16-chunk decoded window / lead16; empirical p95/p99 are maxima with n=5:

Metric main request-ahead
Median drain 1827 ms 1325 ms (−27.5%)
p95/p99 drain 1963 ms 1830 ms
Median peak RSS 730 MiB 834 MiB (+104 MiB)

Additional notes

Adversarial review: pending; not ready for review or merge.

This pull request and its description were written by Isaac.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

This branch was successfully deployed

1 active deployment
azure-prod — 59d98504 Deployed Nov 26, 2026 by vuanhphung via PyO3 build + test (Python 3.10) #1009
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