Effect Hedged Request Race
A tail-latency cap built on Effect.raceFirst: run the request, and if it has not answered within the hedge delay (typically the observed p95), fire one backup attempt and take whichever lands first, interrupting the loser so an abandoned attempt never holds a connection. A token-bucket hedge budget funded by completed traffic caps hedges to a fixed fraction of requests, so a systemic slowdown exhausts the budget and degrades to plain single requests instead of doubling load on a backend that is already hurting. Solves p99 stragglers and the hedge storm that doubles traffic during an outage. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add https://ui.aryank.space/r/effect-hedged-request-race.jsonInstalls from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.
Ninety-nine requests land on healthy replicas, and this one landed on the node mid GC pause. The user pays the straggler's full 400ms because there is no second chance: whatever node the request hit is the node that answers.