Skip to content

perf(proxy): skip complete-range block probes - #223

Merged
ovaistariq merged 5 commits into
mainfrom
perfloop-pr-open-x4pwe00q16
Oct 21, 2026
Merged

ovaistariq merged 5 commits into
mainfrom
perfloop-pr-open-x4pwe00q16

Conversation

@perfloop

@perfloop perfloop Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warm block-cached ranges with BlocksComplete metadata now skip the serial per-block presence probes. For a multi-block single range, the proxy stages and validates the exact first requested slice before sending 206, then streams the remaining blocks through the existing ordered recovery and salvage path. Complete full-object serves keep the same optimistic one-read-per-block path.

Incomplete metadata and staging-budget declines retain the conservative probe-first path. First-slice eviction or recovery failure falls through before headers are committed; mid-stream eviction remains bounded and ETag changes cannot mix versions. The staged buffer uses the exact slice size, and the full client range is still passed to footer prefetch when the stream is split.

The reapplication is aligned with current main's source-local request metrics and block-populate contract. It adds handler-path coverage for warm 2–32-block ranges with a delayed remote cache owner, integration coverage for first-slice fallback, mid-stream recovery, version mismatch, and staging decline, and updates RFC 0001 with the range path and its boundaries.

Tests: make lint-ci, make build, make test, make test-integration, make test-race, and make test-coverage.

Workload: BlocksComplete warm 2-block range

Metric Before After Change
first-206-ns/op 775011 551238 28.9% lower
cache-calls/op 5 3 40% lower

Workload: BlocksComplete warm 4-block range

Metric Before After Change
first-206-ns/op 1210330 555723 54.1% lower
cache-calls/op 9 5 44.4% lower

Workload: BlocksComplete warm 8-block range

Metric Before After Change
first-206-ns/op 2448835 619839 74.7% lower
cache-calls/op 17 9 47.1% lower

Workload: BlocksComplete warm 16-block range

Metric Before After Change
first-206-ns/op 4106535 577000 85.9% lower
cache-calls/op 33 17 48.5% lower

Workload: BlocksComplete warm 32-block range

Metric Before After Change
first-206-ns/op 7883925 607508 92.3% lower
cache-calls/op 65 33 49.2% lower
Checks: 6 passed.

Generated by Perfloop. Measurements and checks.


Note

Medium Risk
Changes the block-cache range hot path for committed 206 responses (pre-commit staging, mid-stream recovery, and version handling), though behavior is heavily regression-tested and falls back to the prior probe-first path when hints or budget decline.

Overview
Warm multi-block range serves on block-cache entries with BlocksComplete now use the same probe-free pattern as complete full-object GETs: one payload read per covering block instead of a serial BlockExists pass plus reads.

For ranges longer than one block (and outside a range-created span certificate), serveRangeFromBlockCache reserves staging for the first requested slice, validates or recovers it before committing 206, then streams the rest through streamBlockRangeWithFooterRange so Parquet footer prefetch still sees the full client range. serveCompleteFromBlocks is generalized with an optional range (rng == nil for full GET). Incomplete metadata or a staging-budget decline still use the conservative probe-first path.

Adds a handler benchmark for warm BlocksComplete ranges (2–32 blocks) over a delayed remote cache owner, integration tests for read counts, first-slice fallback/salvage, ETag mismatch, and staging decline, and updates RFC 0001 with the new read-path step.

Reviewed by Cursor Bugbot for commit f0c2dd2. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue remains.

Summary

The PR skips presence probes for larger ranges on entries marked BlocksComplete.

  • Warm complete block ranges reach 206 without serial presence probes.

Reviews (6) · Last reviewed commit: "Merge origin/main into perfloop-pr-open-..." · Reviewed by Greptile

Comment thread proxy/block_cache.go Resolved
@perfloop
perfloop Bot force-pushed the perfloop-pr-open-x4pwe00q16 branch from 7331133 to 5101b74 Compare September 10, 2026 01:33
greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 10, 2026
ovaistariq and others added 2 commits October 20, 2026 23:24
Resolve the serveRangeFromBlockCache conflict with #265 by keeping both fast paths: the certified
range-span branch runs first, the BlocksComplete optimistic branch second (disjoint entry classes).
RFC read-path steps renumbered; test helpers from both sides kept.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Take main's RecordRequestResult call while keeping the partial-range hit counter,
and make the benchmark writer's checksum order-sensitive (CRC32) so a reordered
block cannot validate.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NGTev5ePU5jHubGtdoUfK6

@ovaistariq ovaistariq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed: generalises serveCompleteFromBlocks to a byte range so BlocksComplete entries skip the serial probe pass; bytes, headers and Content-Range unchanged, evicted blocks recovered inline as the full-object path already does. Rebased on #265/#251, benchmark checksum made order-sensitive.

@ovaistariq
ovaistariq merged commit 21b689c into main Oct 21, 2026
9 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-x4pwe00q16 branch October 21, 2026 21:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 21, 2026
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.22.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants