proxy: add mirror-selection benchmarks #123

Merged
benvin merged 1 commits from benvin/proxy-selection-benchmarks into master 2026-08-13 17:40:22 +10:00

1 Commits

Author SHA1 Message Date
unkin-agent f555f41ada proxy: add mirror-selection benchmarks
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Quantify the latency the mirror load-balancing strategy adds versus a
single-URL remote, and lock it in as a regression guard.

- selection_bench_test.go: isolates baseURLAttemptOrder / beginAttempt /
  endAttempt against a zero-value Engine (no network/DB/redis), covering
  single-URL, round_robin (3/8), least_conn (3/8) and the gauge inc/dec
  pair, plus RunParallel variants to surface sync.Map/atomic contention.
- BENCHMARKS.md: median-of-6 results on a Ryzen 7 4700U with the raw runs
  and the cache-miss-only caveat.

Headline (median of 6, ns/op): single-URL ~133; round_robin ~462 (3) /
~682 (8); least_conn ~2690 (3) / ~15200 (8). Selection runs only on
cache-miss, so cache hits pay zero.
2026-08-13 17:31:47 +10:00