Skip to content

[FEATURE] perf: dedupe concurrent cold archive downloads behind the GitCache shard lock #4797

Closed as not planned

Description

Proposals are welcome before implementation. For substantive changes, wait
for a responsible human maintainer to approve the scope and identify a review
contact. An automated recommendation, label alone, or silence is not approval.
See Contributing.

Is your feature request related to a problem? Please describe.
With the archive transport from #4774, two apm install processes sharing one cache can both miss the same (repo, sha) cold. Each then downloads and verifies the same codeload archive before GitCache.land_tree_checkout takes the shard lock, and the loser discards its copy. Correctness holds: the landing is atomic and re-checked under the lock. But bandwidth and anonymous API quota (one git/trees call) are spent twice. The git path avoids this by taking the shard lock before its cache probe (cache/git_cache.py _create_checkout).

Describe the solution you'd like
Move archive fetch + verification behind a GitCache-owned miss lock for the full-tree shard, and re-check the shard after acquiring it, so waiting installers reuse the first result.

Done when a concurrency test (two processes, one cold shard) records exactly one codeload request and one trees request.

Out of scope: changing archive acceptance or routing.

Describe alternatives you've considered
Leave as is; duplicate work happens only with concurrent cold installs on a shared cache.

Additional context
Follow-up from the Copilot review on #4774; refs #4776.

Activity

  1. added
    type/feature
    on Nov 22, 2026
  2. danielmeppiel commented on Nov 22, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Performance. With the archive transport (#4776), the archive fetch and its verification run behind a GitCache-owned miss lock for the full-tree shard, and the shard is re-checked after the lock is acquired, so concurrent cold installs that share one cache reuse the first verified result instead of downloading and verifying the same archive twice. Archive acceptance, verification, routing and the atomic landing under the shard lock are unchanged.
    Done when: A concurrency test with two processes and one cold shard records exactly one codeload request and one trees request, and both installs succeed with identical content; existing archive transport tests stay green; CI is green. A CHANGELOG line is added if the archive transport has shipped by then.
    Out of scope: Changing archive acceptance or routing; the git transport path; lock behaviour for other cache shards.
    Review contact: Daniel Meppiel (@danielmeppiel)

  3. added
    status/accepted
    performance
    on Nov 22, 2026
  4. danielmeppiel commented on Nov 22, 2026

    @danielmeppiel
    CollaboratorAuthor

    Closed as not planned: the archive transport (#4774) was stopped on benchmark evidence (see the #4774 PR comment). The scope record on this issue is withdrawn with this closure.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancestatus/acceptedtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions