Skip to content

Avoid copying Thrift CloudFetch response buffers - #627

Open
vuanhphung wants to merge 2 commits into
mainfrom
perf/thrift-cloudfetch
Open

vuanhphung wants to merge 2 commits into
mainfrom
perf/thrift-cloudfetch

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Thrift CloudFetch's arrayBuffer() copies node-fetch's already-consumed Buffer. A live 2.109 GB catalog-sales profile attributes 725 ms of self time to that copy; the candidate profile has zero samples there.

Carry response.buffer() directly through the Arrow handoff, removing one full-body allocation. Scheduling, concurrency 10, CloudFetch LZ4-off, retries, logging and telemetry stay unchanged. This is Thrift-only because kernel HTTP/body handling is native. There is a mechanical textual conflict with #610: whichever lands second must use const bodyRead = response.buffer(); inside its idle-timer wrapper. #623's row-limit path is untouched.

Verification: 1806 unit tests (including 28 CloudFetch) and lint/format/types/build pass. A real-HTTP pooled-Arrow test catches the production-read copy mutant. Live Thrift 4/4, kernel 7/7 and full-value/null/limit parity passed on identical runtime code.

Independent adversarial measurements find 10–14% lower CPU and 7–15% lower median peak RSS on live catalog drains. Node 24.22.1; rotated fresh-process A/B, warm-ups discarded, shared live warehouse; medians:

Scenario Pairs Elapsed main → branch
Mock: 64 real Arrow files, 30 ms RTT, drain 7 1.440 → 1.104 s (-23.3%)
Live catalog, actual 2.109 GB, drain 7 10.883 → 9.716 s (-10.7%)
Same, pinned to 4 logical CPUs 5 11.559 → 9.920 s (-14.2%)

Elapsed gains are not repeatable at 216 MB or on materialized/storage-bound results; no universal/tail speedup is claimed. Largest materializations hit the 115 s cap on both revisions. Accepted baseline: mid-download close/cancel emits one error-telemetry event on both main and branch, pre-existing on main and unchanged by this PR; neither produces ERROR logs or unhandled rejections.

Adversarial review: round 1 converged with no high findings; evidence wording corrected, production-path coverage added, and unchanged lifecycle telemetry accepted separately.

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>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@vuanhphung
vuanhphung marked this pull request as ready for review November 19, 2026 15:41

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

This branch was successfully deployed

1 active deployment
azure-prod — 48318736 Deployed Nov 19, 2026 by vuanhphung via e2e-test (26.12.1, 26_12_1) #2150
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