RpcLoadBalancer.LoadBalancer.SelectionAlgorithm.LeastConnections
(rpc_load_balancer v0.3.4)
Copy Markdown
View Source
Least connections node selection algorithm.
Tracks active connection counts per node using ETS counters and always
selects the node with the fewest active connections. When a call completes,
release_node/2 must be called to decrement the counter. The convenience
API in RpcLoadBalancer.LoadBalancer.call/5 handles this automatically.
Hot-path implementation uses CounterCache.get_node_count/2 (which
bypasses the telemetry wrapper) and a single-pass Enum.reduce/3 that
allocates one tuple instead of building an intermediate list.