Skip to content

feature: implement Adaptive load balancer with softmax selection - #9

Merged
ktrubilo9 merged 4 commits into
mainfrom
feature/adaptive-lb
Jul 11, 2026
Merged

ktrubilo9 merged 4 commits into
mainfrom
feature/adaptive-lb

Conversation

@ktrubilo9

Copy link
Copy Markdown
Owner

Description

This PR adds a new adaptive load balancing strategy that scores backends based on runtime metrics (latency EWMA, error rate, consecutive failures, active connections) and selects them probabilistically using softmax.

Changes

  • Added AdaptiveLB implementation in internal/lb/adaptive.go
  • Added comprehensive unit tests in internal/lb/adaptive_test.go
  • Updated GetLoadBalancer to support "adaptive" strategy
  • Minor logic fix in Next() to properly handle disabled backends

Why

The adaptive strategy allows the proxy to prefer healthier backends under load, reducing latency and error rates compared to pure least-connections (as shown in earlier experiments).

Closes #6

@ktrubilo9
ktrubilo9 merged commit 45dbb0c into main Jul 11, 2026
1 check passed
@ktrubilo9
ktrubilo9 deleted the feature/adaptive-lb branch July 11, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lb): add adaptive load balancer based on metrics

1 participant