Effect Shard Router with Backpressure
A work router that keeps one viral key or one noisy tenant from drowning a single worker. A consistent-hash ring (FNV-1a with virtual nodes) places cold keys, and any key that crosses a frequency threshold is split by power-of-two-choices: hash two ring positions and dispatch to the shallower shard, so a hot key spreads across several workers instead of pinning one. Each shard is a bounded Queue, so a full queue makes offer block and backpressure propagates to the producer rather than growing an unbounded backlog in memory. Low-priority work goes to a dropping Queue that sheds load under pressure instead of blocking, and a per-shard Metric gauge exposes live depth for autoscaling. Solves hot partitions and queue backlog. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add @compronents/effect-shard-router-backpressureInstalls from ui.aryank.space. Needs a registry token and a one-time @compronents entry in components.json. The docs walk through both.
A consistent-hash ring places cold keys; a key that crosses a frequency threshold splits by power-of-two-choices and dispatches to the shallower of two shards, so one hot key spreads across workers instead of drowning one.