Implemented EWMA-scored replica selection replacing round-robin:
- score(node) = α · latency_p95_ms + β · in_flight_count + γ · error_rate
- Router picks lowest-scoring node with probability 1-ε
- With ε (default 0.05) picks uniformly random for exploration
Config (plan §13.3):
replica_selection:
strategy: adaptive | round_robin | random
latency_weight: 1.0
inflight_weight: 2.0
error_weight: 10.0
ewma_half_life_ms: 5000
exploration_epsilon: 0.05
Metrics:
- miroir_replica_selection_score{node_id} gauge
- miroir_replica_selection_exploration_total counter
Acceptance tests pass:
- Degraded node traffic drops within 2× half-life
- Node recovers after latency clears
- Exploration samples degraded node (~1.7% with ε=0.05)
- Round-robin fallback works identically to Phase 1
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| src | ||
| static | ||
| tests | ||
| Cargo.toml | ||