Skip to content

perf(proxy): avoid joining signing paths and queries - #304

Open
perfloop[bot] wants to merge 2 commits into
mainfrom
perfloop-pr-open-qxg7q8rtjx
Open

perfloop[bot] wants to merge 2 commits into
mainfrom
perfloop-pr-open-qxg7q8rtjx

Conversation

@perfloop

@perfloop perfloop Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Pass the decoded path and raw query separately to the signer instead of joining and immediately splitting them. SignRequest keeps its combined-target contract. Paths containing a literal ? retain the existing join-and-split fallback; URL escaping, raw-fragment handling, body setup, and signing still use the common implementation.

The existing benchmark in proxy/forwarder_signing_benchmark_test.go now covers empty, short, and longer list queries alongside its tagging request.

Measurements

Local paired benchmark measurements used matched Go 1.27.2 builds and GOMAXPROCS=4. They cover the complete signing passthrough path, including validation and response forwarding. A controlled transport returns an empty HTTP 200 response, excluding upstream network time. The continuation tokens are constructed inputs, not sampled production queries. Warmup invocations are excluded.

Each metric cell shows the before and after medians, followed by the median paired decrease in the same units. Each row is a separate experiment:

Query Complete pairs ns/op before → after (paired decrease) B/op before → after (paired decrease) allocs/op before → after (paired decrease)
2KiB token 28 53292 → 52544.5 (1105) 38836.5 → 36500.5 (2335.5) 173 → 172 (1)
8KiB token 29 126890 → 123360 (3842) 115880 → 106231 (9621) 173 → 172 (1)
Empty 25 23775 → 23572 (296) 12922 → 12930 (-4) 164 → 164 (0)
Short list query 37 25416 → 25307 (127) 14054 → 13997 (53) 173 → 172 (1)

Allocated bytes improved for both longer-token workloads. All elapsed-time and allocation-count guards, and the empty/short-query byte guards, met their 5% no-regression bounds. The empty-query byte median was slightly higher; this is not a claim of zero overhead or a demonstrated elapsed-time speedup. Production query mix and end-to-end latency remain unmeasured.

Measurements selected each row separately in precompiled native Go test binaries:

./proxy.test -test.run='^$' -test.bench='^BenchmarkServiceHandlePassthroughSigning$/^2KiB$' -test.benchmem -test.benchtime=300ms -test.cpu=4 -test.count=1
./proxy.test -test.run='^$' -test.bench='^BenchmarkServiceHandlePassthroughSigning$/^8KiB$' -test.benchmem -test.benchtime=300ms -test.cpu=4 -test.count=1
./proxy.test -test.run='^$' -test.bench='^BenchmarkServiceHandlePassthroughSigning$/^empty$' -test.benchmem -test.benchtime=300ms -test.cpu=4 -test.count=1
./proxy.test -test.run='^$' -test.bench='^BenchmarkServiceHandlePassthroughSigning$/^short$' -test.benchmem -test.benchtime=300ms -test.cpu=4 -test.count=1

Native benchmark reproduction:

go test ./proxy -run '^$' -bench '^BenchmarkServiceHandlePassthroughSigning$' -benchmem -benchtime=300ms -cpu=4 -count=1

Validation

The Go auth/proxy unit tests, focused signing race tests, and routed signing-handler checks passed. The new target test checks query separators, escaping, raw fragments, and the literal-question-mark fallback. Existing signer tests cover context, body setup, endpoint errors, and legacy signature equivalence. The handler checks cover independent upstream signature validation and complete versus truncated response delivery.

S3 compatibility tests (tiered): unresolved in target CI. This change does not claim to repair that failure.

Related work: #200 changes presigned forwarding; this removes target assembly in the existing header-signing builder.

Case and evidence


Made by Perfloop. To ask for a change, comment or review in plain words. How Perfloop handles pull requests.

Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR avoids joining the decoded path and raw query before signing.

  • Signing-mode forwarding skips joining paths and queries.

No actionable issues were found. Tests were inspected, not run during this review.

Reviews (1) · Last reviewed commit: "perf(proxy): avoid joining signing path ..." · Reviewed by Greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant