Skip to main content

Module lb

Module lb 

Source
Expand description

Load balancer for backend selection

This module handles backend selection (service -> specific backend addr). The ServiceRegistry handles routing (host+path -> service). These are separate concerns.

§Strategies

§Health checking

LoadBalancer::spawn_health_checker launches a background task that periodically TCP-connects to every backend across all groups, updating health status atomically. Concurrency is bounded by a semaphore.

Structs§

Backend
Per-backend state with atomic connection counting and health tracking.
BackendGroup
A set of backends for a single service, with a configured selection strategy.
BackendGroupSnapshot
Point-in-time snapshot of a backend group’s state.
BackendSnapshot
Point-in-time snapshot of a single backend’s state.
ConnectionGuard
RAII guard that decrements a backend’s active connection count on drop.
LoadBalancer
Top-level load balancer that manages backend groups keyed by service name.

Enums§

HealthStatus
Whether a backend is considered reachable.
LbStrategy
Load-balancing strategy for a backend group.