Expand description
Proxy rotation strategy trait and built-in implementations.
§Why Thompson Sampling
Round-robin assumes proxy health is stationary; in practice a proxy that
worked a minute ago may now be banned, and a dead one may recover.
Round-robin therefore wastes a fixed fraction of every batch on dead
proxies. Thompson sampling — see
docs/dev/project/scraping-guide-2026-llm-context.md
§“Stop Round-Robining Dead Proxies: Bayesian Selection” (L3018-3021)
— models each proxy’s success probability as a Beta(α, β) posterior
and draws one sample per candidate on each acquisition. The 2026
ProxyOps benchmark cited in the guide reports 76 % success with
Thompson sampling vs 36 % with round-robin on identical proxies and
targets (549 114 requests in 7 days) — more than double the success
rate.
[ThompsonStrategy] is the Stygian implementation; it lives behind the
bayesian-rotation cargo feature (off by default to preserve
deterministic round-robin in existing deployments). The hot path is
two atomic loads + one xorshift64 draw per candidate, which stays well
under the 1 µs acquisition budget documented in
crates/stygian-proxy/AGENTS.md.
Structs§
- Least
Used Strategy - Selects the healthy proxy with the fewest total requests.
- Noop
Bayesian Observer - Discarding
BayesianObserverused when no strategy is configured. - Proxy
Candidate - A lightweight view of a proxy considered for selection.
- Random
Strategy - Selects a healthy proxy uniformly at random on each call.
- Round
Robin Strategy - Cycles through healthy proxies in order, distributing load evenly.
- Weighted
Strategy - Selects a healthy proxy with probability proportional to its
weight.
Traits§
- Bayesian
Observer - Callback that receives outcome observations for a specific proxy.
- Rotation
Strategy - Selects a proxy from a slice of candidates on each request.
Functions§
- capable_
healthy_ candidates - Filter
allto candidates that are healthy and satisfyreq. - healthy_
candidates - Filter
allto only the candidates that are currently healthy.
Type Aliases§
- Boxed
Bayesian Observer - Shared-ownership type alias for a
BayesianObserverimplementation. - Boxed
Rotation Strategy - Shared-ownership type alias for a
RotationStrategyimplementation.