feat(git): warm most-cloned repos in the background after startup#299
Draft
worstell wants to merge 2 commits into
Draft
feat(git): warm most-cloned repos in the background after startup#299worstell wants to merge 2 commits into
worstell wants to merge 2 commits into
Conversation
9839a22 to
b0b0fb3
Compare
b0b0fb3 to
84b4d69
Compare
84b4d69 to
09acad1
Compare
Query held RLock while m.ns() wrote to m.state on first access for a namespace, racing with concurrent Apply on other namespaces. Read the map directly; queryState handles a nil namespace map.
09acad1 to
fc8e253
Compare
Adds prewarm-most-cloned-repos to the git strategy. When > 0, the strategy launches a background pass after warmExistingRepos completes that warms that many of the top repos (per the per-repo histogram, summed over the last 14 days) so subsequent requests for popular repos hit a warm local mirror. 0 (default) disables. Does not gate Ready(). Cold-path fallbacks in the snapshot/bundle/wire- protocol handlers already serve traffic correctly while warming runs, so the pod can join the LB immediately. Per-repo failures and an empty histogram are logged and otherwise ignored — this is an optimization, not a correctness invariant. Uses FetchTimeout (not CloneTimeout) on the fetch path so a slow upstream on an already-cloned mirror cannot extend prewarm by an hour. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019e4193-0c35-732e-96f0-b9c97aed2fae
fc8e253 to
1a1728f
Compare
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.
Adds
prewarm-most-cloned-reposto the git strategy. When > 0, launches a background pass after startup that warms the top N repos (per the per-repo histogram, summed over the last 14 days) so subsequent requests for popular repos hit a warm local mirror.0(default) disables.Does not gate
Ready(). Cachew's snapshot/bundle/wire-protocol handlers already serve cold pods correctly via S3-cache and upstream-pass-through fallbacks; the prewarm pass is an optimization that reduces first-request latency for popular repos and accelerates when this pod begins contributing to S3 mirror-snapshot freshness, without making cold pods wait to join the LB.Per-repo failures and an empty histogram are logged and otherwise ignored — this is an optimization, not a correctness invariant.
Includes a metadatadb fix:
MemoryBackend.Querylazy-created the namespace under a read lock, racing with concurrentApplyon other namespaces.