AdaptiveLoadShedding

Priority-tiered load shedding based on live system stats (CPU percentage + goroutine count). Lower-priority traffic is dropped earlier than critical traffic. The server actively sheds load to preserve stability instead of failing slowly.

0%25%50%75%100%Critical Shed (100%)Normal Shed (85%)Low Shed (70%)current CPU: 88%Low: SHED ✗ (88 > 70)Normal: SHED ✗ (88 > 85)Critical: PASS ✓ (88 < 100)

Signature

action contract
func AdaptiveLoadShedding[Req, Res any](stats SystemStats, cfg LoadShedConfig, p Priority) Middleware[Req, Res]