Add short-TTL attribute cache for serveBlobInfo#193
Merged
raymondjacobson merged 3 commits intoOpenAudio:mainfrom Apr 4, 2026
Merged
Add short-TTL attribute cache for serveBlobInfo#193raymondjacobson merged 3 commits intoOpenAudio:mainfrom
raymondjacobson merged 3 commits intoOpenAudio:mainfrom
Conversation
Cache bucket.Attributes results in serveBlobInfo for 60s to reduce HeadObject calls from peer probes. Peers re-verify redirect targets on every request, and sniffAndFix fans out to all nodes per CID, making this endpoint a significant source of metadata API calls. Also moves the dbHealthy check before the storage call so unhealthy nodes return 500 without hitting the storage backend.
| uploadOrigCidCache: imcache.New(imcache.WithMaxEntriesLimitOption[string, string](50_000, imcache.EvictionPolicyLRU)), | ||
| imageCache: imcache.New(imcache.WithMaxEntriesLimitOption[string, []byte](10_000, imcache.EvictionPolicyLRU)), | ||
| trackAccessInfoCache: imcache.New(imcache.WithMaxEntriesLimitOption[string, trackAccessInfo](50_000, imcache.EvictionPolicyLRU), imcache.WithDefaultExpirationOption[string, trackAccessInfo](5*time.Minute)), | ||
| attrCache: imcache.New(imcache.WithMaxEntriesLimitOption[string, *blob.Attributes](50_000, imcache.EvictionPolicyLRU)), |
Contributor
There was a problem hiding this comment.
50K is huge for this if it has 60s expiry - this would be > 800 unique CID per second to fill, updating to 10K & then will merge
With a 60s TTL, 50K entries is oversized — 10K is plenty for the expected lookup rate and avoids unnecessary memory reservation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
raymondjacobson
approved these changes
Apr 4, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
bucket.Attributesresults inserveBlobInfofor 60s to reduce HeadObject calls from peer probes. 50K entries, LRU eviction, per-entry TTL. No negative caching.dbHealthycheck before the storage call so unhealthy nodes return 500 without hitting R2.