Repository navigation
Cache merge bases, work on branches in parallel, and fetch in the background - #99
Merged
Merged
Conversation
…kground [minor] A state request naming a few hundred branches ran one git merge-base per branch, one after another, on every request. Merge bases are now cached by mirror, client base and branch tip, uncached branches are worked on several at a time, and each clone and fetch writes a commit-graph so an uncached merge base stays quick on a long history. Refs a little past RefsTtl are answered from while one fetch runs in the background, capped so they are never older than AdmissionTtl. New settings: RefsServeStaleFor (30 seconds), MaxCachedMergeBases (20,000) and MaxConcurrentBranchQueries (4).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Written by Claude (Claude Code) on behalf of Matt Edmondson.
Problem
Against a Knockout-shaped test repository (36,458 commits, 314 branches), a warm
POST /stateon the deployed 1.0.42 took 4.5 s for one path and 6.5 s with no paths. The diff cache was hitting. The time went on onegit merge-baseprocess per branch, run one after another on every request and never cached, on a mirror with no commit-graph. The first request afterRefsTtlalso waited on a fetch from the forge.Changes
MirrorQueriesremembers merge bases by mirror, client base and branch tip, least recently used first out, up toMaxCachedMergeBases(default 20,000). Both ids are immutable, so an entry never needs invalidating. Failures are not cached.BranchStateHandlerfinds merge bases and diffs for up toMaxConcurrentBranchQueries(default 4) branches at once, then assembles the answer in matched order, so the response reads the same as before.git commit-graph write --reachable --split. A failure is logged and otherwise ignored, because a mirror without a graph answers the same questions more slowly.RefsTtlandRefsTtl + RefsServeStaleFor(default 30 s) are answered from disk while one fetch runs in the background under the caller's already-admitted credential. The window is capped where it would passAdmissionTtl, so answered refs are never older than the existing rule allows. It is capped rather than refused by the validator, so a deployment that already runsRefsTtlclose toAdmissionTtlkeeps starting. Setting it to zero restores the old behavior.refsAsOfstill reports the true age.README,
deploy/k8s/configmap.yamland the tool'sappsettings.jsonlist the new settings.Measurements
A local run of this branch on Windows against the test repository, where starting a process costs more than on the Linux pod:
Tests
🤖 Generated with Claude Code