miroir/crates/miroir-proxy/src
jedarden 99767d95c7 P5.3 §13.3: Adaptive replica selection (EWMA-based)
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>
2026-05-23 13:35:03 -04:00
..
routes P5.3 §13.3: Adaptive replica selection (EWMA-based) 2026-05-23 13:35:03 -04:00
admin_session.rs P10.4: ADMIN_SESSION_SEAL_KEY cookie sealing with XChaCha20-Poly1305 2026-04-19 17:18:39 -04:00
auth.rs P2.7: Add test coverage for /health and /version dispatch-exempt endpoints 2026-05-22 15:26:49 -04:00
client.rs P3: Task Registry + Persistence — 14-table SQLite schema, Redis mirror, Helm validation 2026-04-24 15:50:20 -04:00
error.rs Integrate MeilisearchError into proxy (IntoResponse, auth middleware) + telemetry 2026-04-19 05:21:09 -04:00
lib.rs P10.5: scoped Meilisearch key rotation with multi-pod coordination 2026-04-20 07:33:29 -04:00
main.rs P2.1: Fix session_pinning blocking read and verify acceptance criteria 2026-05-23 12:19:10 -04:00
middleware.rs P5.3 §13.3: Adaptive replica selection (EWMA-based) 2026-05-23 13:35:03 -04:00
otel.rs P7.6: Implement OpenTelemetry tracing (disabled by default) 2026-04-19 10:15:39 -04:00
scoped_key_rotation.rs P3: Task Registry + Persistence — 14-table SQLite schema, Redis mirror, Helm validation 2026-04-24 15:50:20 -04:00