Effect Weighted Load Balancer
Load balancing that notices a degraded backend instead of feeding it its rotation share. Round-robin routes a fixed slice to a server whose in-flight queue is climbing (GC pause, cold cache); the power-of-two-choices strategy samples two random backends and picks the one with fewer in-flight requests, near-optimal balance with two counter reads and no global scan or herd. Each backend's in-flight count is a Ref bracketed by Effect.ensuring so a failed or interrupted request still decrements, and the demo shows a 12x-slower backend shedding to a third of its round-robin load. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add https://ui.aryank.space/r/effect-weighted-load-balancer.jsonInstalls from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.
Round-robin hands the degraded backend its full rotation share. b3 is 12x slower, yet its in-flight queue climbs to 12 and stays there while a third of traffic waits behind it.