Skip to content

perf: skip header clones for stream-only PUTs - #175

Merged
ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-ntvwxyb4q0
Aug 20, 2026
Merged

ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-ntvwxyb4q0

Conversation

@perfloop

@perfloop perfloop Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Split response streaming from metadata capture so normal PUT forwarding skips cloning upstream headers it does not retain. Add a concurrent transparent PUT benchmark through the public handler route.

Keep the header clone in the write-through tee path, where its independently owned ETag is needed after streaming.

Testing

  • make lint-ci
  • make test-proxy
  • go test ./handlers

Workload: concurrent authenticated transparent PutObject with the default enabled-cache configuration

Metric Before After Change
stream_header_clone_alloc_space_bytes/op 494.5 0 100% lower
stream_header_clone_alloc_objects/op 3.131 0 100% lower
Checks: 3 passed.

Generated by Perfloop. Measurements and checks.


Note

Low Risk
Internal forwarding allocation change with tests covering header ownership; no auth or request-path behavior change.

Overview
Stops cloning upstream response headers on the common stream-only PUT path. executeAndStream now streams without retaining a header copy; executeAndStreamReturningMeta still clones so the write-through tee can keep an independent ETag after the body is consumed.

Adds a unit test that the captured headers are owned (not aliased to the upstream map) and a concurrent transparent PutObject benchmark through the public handler route.

Reviewed by Cursor Bugbot for commit bf229fc. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown

Greptile Summary

Splits response streaming from optional metadata capture so ordinary PUT forwarding avoids cloning upstream headers while the write-through tee retains independent ETag metadata.

  • Adds conditional metadata capture to the shared forwarding implementation.
  • Adds ownership coverage for metadata-returning forwarding.
  • Adds a concurrent authenticated transparent PUT benchmark through the public handler route.

Confidence Score: 5/5

The PR appears safe to merge because stream-only callers discard metadata and the sole metadata-dependent write-through path continues to receive cloned headers.

The optimization changes only the discarded metadata return for ordinary forwarding, while preserving response streaming and independently owned headers for the ETag-consuming tee path.

Important Files Changed

Filename Overview
proxy/forwarder.go Introduces optional response-header cloning while preserving independent header ownership for the write-through metadata path.
proxy/forwarder_test.go Verifies captured response headers remain independent of the upstream header map and slices.
handlers/transparent_put_benchmark_test.go Adds a concurrent end-to-end benchmark for authenticated transparent PUT forwarding and validates the complete upstream response.

Reviews (1): Last reviewed commit: "perf: skip header clones for stream-only..." | Re-trigger Greptile

@ovaistariq
ovaistariq merged commit d8fe4f0 into main Aug 20, 2026
11 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-ntvwxyb4q0 branch August 20, 2026 20:12
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 20, 2026
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants