Repository navigation
perf(proxy): skip response capture for cache-disabled deletes - #301
Open
perfloop[bot] wants to merge 2 commits into
Open
perfloop[bot] wants to merge 2 commits into
perfloop[bot] wants to merge 2 commits into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
[Low impact] The PR appears safe to merge. SummaryCache-disabled
Review was based on source inspection; tests and benchmarks were not run. Reviews (1) · Last reviewed commit: "perf(proxy): skip response capture for c..." · Reviewed by Greptile |
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.
Stream cache-disabled
DeleteObjectsresponses throughForwardinstead of retaining an unused response capture. Cache-enabled result parsing and response fences stay unchanged. Reuse fixed-size copy scratch so small replies do not acquire a fresh copy buffer on every request.Keep pre-header forwarding errors and the existing post-header return and request-metric behavior. This is not a repair for incomplete response delivery.
Benchmarks
proxy/delete_objects_benchmark_test.gomeasures complete handler forwarding to a local HTTP origin, with caching disabled, distinct 128-byte keys and non-quietDeleteResultreplies. It includes request buffering and origin work, and checks delivered status, content type and byte count.Local run with Go 1.27.2: three paired runs per row, alternating arm order, after excluded warmups. Each row ran separately:
The allocation reduction is the intended improvement. Elapsed time and the one-entry row are controls; these local estimates do not establish a no-regression guarantee. Paired change is the median percentage change within pairs, not a ratio of the separate arm medians.
Local paired benchmark rows
Selected native benchmark rows from the local runs above, with warmups excluded. Each before row pairs with the corresponding after row of the same size; execution order alternated between before-first and after-first.
Before (three runs per size, in pair order):
After (three runs per size, in pair order):
An allocation profile of the large-reply run no longer attributes samples to
executeAndCaptureafter the change. Small-reply timing estimates varied in both directions, including in a longer control run.Request bodies remain buffered, and the pool may retain fixed-size scratch between requests. Peak heap, CPU time, p99 latency and production input prevalence remain unmeasured;
ns/opabove is elapsed handler time.Testing
Focused Go tests for bulk-delete forwarding, response-byte accounting and routed response fences passed. They cover status/header/body preservation, transport and body-copy failures, upstream closure, streaming progress and enabled-cache fencing. Formatting and module-consistency checks passed.
Made by Perfloop. To ask for a change, comment or review in plain words. How Perfloop handles pull requests.
Note
Medium Risk
Changes the bulk-delete proxy forwarding path and error-return semantics for cache-disabled traffic, though behavior is explicitly preserved and tested; cache-enabled invalidation logic is untouched.
Overview
When caching is off, bulk
DeleteObjectsnow streams upstream responses viaForwardinstead of buffering them withForwardWithCapture, since per-key<Error>parsing is only needed for cache fencing. The cache-enabled path is unchanged: capture, staged headers, and post-success re-invalidation still run as before.Streaming uses a
sync.Poolof 32 KiB scratch buffers andio.CopyBufferso body copies do not allocate a fresh buffer every request. A smalldeleteObjectsStreamWriterwraps the existingstatusRecorderso post-header copy failures still do not surface as the handler error (matching prior capture forwarding), while status, headers, body passthrough, outbound byte metrics, and upstream body closure stay covered by new tests and a cache-disabled benchmark.Reviewed by Cursor Bugbot for commit bb8420d. Bugbot is set up for automated code reviews on this repo. Configure here.