Skip to content

Bound a worker's input fetches with one pool across the actions it stages - #2952

Merged
MarcusSorealheis merged 4 commits into
TraceMachina:mainfrom
amankrx:feat/worker-download-fanout
Oct 16, 2026
Merged

MarcusSorealheis merged 4 commits into
TraceMachina:mainfrom
amankrx:feat/worker-download-fanout

Conversation

@amankrx

@amankrx amankrx commented Oct 16, 2026

Copy link
Copy Markdown
Member

What and why

A worker staging several cold actions at once opened up to 64 input fetches per directory level per action, so four actions with wide trees could hold a few hundred reads open against the CAS or the object store together. That is what a throttled store sees from a fresh worker pool.

The worker now draws every blob fetch into its store from one pool shared across the actions it stages. max_concurrent_input_downloads on the worker config sets its size (default 64, today's per-level constant). The permit covers the fetch alone, never the directory walk under it, so a deep tree cannot deadlock the pool, and a blob already in the store is linked without one.

How was this verified?

A new test stages a 40 file tree through a pool of 3 against a slow store that counts in-flight reads and asserts the peak never passes 3 while every file lands. The existing worker tests, clippy and the pinned rustfmt pass.

Risk

Low. A single action behaves as before; only a worker staging several actions at once fetches less in parallel than it did.

AI assistance

An agent drafted the change and I reviewed every line.

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nativelink Ready Ready Preview Oct 16, 2026 3:48pm UTC
nativelink-aidm Ready Ready Preview Oct 16, 2026 3:48pm UTC

Request Review

/// slow store than the pool holds.
#[cfg(target_family = "unix")]
#[nativelink_test]
async fn download_to_directory_bounds_fetches_by_the_pool()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Request: please add a test where two or more downloads share one pool. That's the behavior this PR is for.

This test runs a single tree through a pool of 3, which a per-call limit would also pass. Something like two concurrent download_to_directory_bounded calls on one Semaphore::new(3), asserting max_in_flight() <= 3, would cover the cross-action limit. A case for 0 → 64 in RunningActionsManagerImpl::new would also be nice.

corcillo
corcillo previously approved these changes Oct 16, 2026

@MarcusSorealheis MarcusSorealheis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@MarcusSorealheis
MarcusSorealheis merged commit 23b4472 into TraceMachina:main Oct 16, 2026
40 checks passed

This branch was successfully deployed

2 active deployments
Preview – nativelink — 75cae4c3 Deployed Oct 16, 2026 by vercel[bot]
Preview – nativelink-aidm — 75cae4c3 Deployed Oct 16, 2026 by vercel[bot]
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.

3 participants