Repository navigation
perf(proxy): stream background cache warms directly to cache - #198
Conversation
Greptile SummaryThis PR replaces the broadcaster/listener pipeline for detached full-object cache warms with direct streaming into whole-object or block cache writers.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified. The direct population path preserves body-before-metadata publication, tombstone checks, anonymous-access handling, bounded admission, and timeout cleanup while removing intermediate broadcaster buffering. Important Files Changed
Reviews (1): Last reviewed commit: "perf(proxy): bound direct cache memory" | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dc7b2ec. Configure here.
|
Addressed in The retry path now creates a new bounded acquisition context after the origin GET rather than reusing the pre-fetch context. This prevents an expired acquisition deadline from declining an otherwise admissible warm. |
|
🎉 This PR is included in version 1.21.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

The change
Detached full-object cache warms now pass the upstream response body directly to the existing whole-object or block cache writer. Foreground request coalescing still uses the broadcaster listener path.
The existing status, size, cache-control, anonymous ACL, detached-timeout, representation-selection, write-start, and tombstone-aware publication behavior remains in place. The memory budget accounts for the direct transport and storage buffers, and reserves an exact-sized block scratch buffer only when the response selects block mode. Warm-on-write retries create a fresh bounded acquisition context after the origin fetch instead of reusing the pre-fetch wait deadline.
Skipped and failed cache writes drain the upstream body before closing it, preserving connection reuse. The configuration documentation describes the direct-writer reservation.
Tests
go test ./proxy/... -count=1go test -race ./proxy -run '^(TestFetchFullObjectToCache_|TestHandlePutObject_WarmOnWrite_|TestSetupCacheListener_|TestStreamFromUpstream_|TestService_BackgroundReservation|TestContextBoundReader|TestWaitForCacheWrite|TestBackgroundPopulateBufferBytes|TestBackgroundReservationIncludesClusteredStreamBuffers|TestBackgroundReservationAddsBlockScratchOnlyAfterSelection|TestGetExactBlockBuf)$' -count=1go vet ./proxy/...make lint-ciWorkload:
two concurrent 4 MiB cacheable block-mode background populates under 256 MiB capallocs/opWorkload:
two concurrent 4 MiB cacheable whole-object background populates under 256 MiB capallocs/opGenerated by Perfloop. Measurements and checks.