Skip to content

perf(cache): parallelize tiered heal reads from the source tier#388

Open
worstell wants to merge 1 commit into
mainfrom
worstell/tiered-parallel-heal
Open

perf(cache): parallelize tiered heal reads from the source tier#388
worstell wants to merge 1 commit into
mainfrom
worstell/tiered-parallel-heal

Conversation

@worstell

Copy link
Copy Markdown
Contributor

The tier-0 heal (backfillTier0FromSource) pulled the whole object from the source tier as a single stream, so parallel throughput depended on the source: S3 fans out internally, but any other tier (e.g. a future remote HTTP tier) would be limited to one connection.

The heal now uses client.ParallelGetReader against the source tier directly, with every request pinned to the healed revision via If-Match so a concurrent rewrite fails the heal instead of splicing revisions. Discovery degrades to a single stream when the source lacks Range or ETag support, so non-range-capable sources behave as before.

Heal chunks are sized at minRangePartSize (4 MiB), below the S3 tier's internal large-range fan-out threshold, so each chunk maps to exactly one upstream request and fan-out is never applied twice.

Follow-ups (separate PRs): generalize the S3 byte-window adapter over any Cache, and apply the large-range fan-out policy on the Remote/Tiered ranged-read path.

@worstell
worstell marked this pull request as ready for review July 20, 2026 20:35
@worstell
worstell requested a review from a team as a code owner July 20, 2026 20:35
@worstell
worstell requested review from stuartwdouglas and removed request for a team July 20, 2026 20:35

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd75fd5888

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cache/tiered.go Outdated
The tier-0 heal previously pulled the whole object from the source tier as a
single stream, so only an S3 source (which fans out internally) saturated the
link. The heal now drives client.ParallelGetReader itself, pinned to the
healed revision via If-Match, giving any Range-capable source tier parallel
throughput and degrading to a single stream for sources without Range/ETag
support. Heal chunks stay below the S3 tier's internal large-range fan-out
threshold so requests are never amplified twice.
@worstell
worstell force-pushed the worstell/tiered-parallel-heal branch from cd75fd5 to d1381a2 Compare July 20, 2026 20:50
@worstell
worstell requested a review from alecthomas July 20, 2026 21:52
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