feat: weighted random routing + mode switching + EWMA smoothing + stale eviction
- Weighted random routing (math/rand/v2 per-goroutine ChaCha8) - PUT /api/route/mode for runtime mode switch (best / weighted_random) - EWMA score smoothing (configurable smoothing_factor, default 0.3) - Periodic stale node eviction (5 min threshold, 60s interval) - Non-blocking WS broadcast (per-client buffered channel + writePump) - Background rate limiter cleanup goroutine - In-memory trunk gateway cache (zero disk I/O in hot path) - Configurable load_avg multiplier (default 50.0, backward compat) - UI mode indicator + admin Switch button in dashboard - 42 tests: weighted random, mode switching, EWMA, eviction, API integration
This commit is contained in:
@@ -226,6 +226,7 @@ type BalancerInfo struct {
|
||||
RouteTotal int64 `json:"route_total"`
|
||||
RouteFallbacks int64 `json:"route_fallbacks"`
|
||||
UptimeSec int64 `json:"uptime_sec"`
|
||||
BalanceMode string `json:"balance_mode"`
|
||||
}
|
||||
|
||||
// --- WebSocket ---
|
||||
|
||||
Reference in New Issue
Block a user