Inferensys

Glossary

Weighted Least Connections

Weighted Least Connections is a dynamic load balancing algorithm that directs new requests to the server with the lowest number of active connections relative to its assigned capacity weight.
Moody home-office setup in a converted highrise loft, analyst working late with multiple screens showing knowledge graph visualizations, city lights through large windows behind.
LOAD BALANCING ALGORITHM

What is Weighted Least Connections?

Weighted Least Connections is a dynamic load balancing algorithm that selects a server based on its current active connection count relative to a pre-assigned capacity weight.

Weighted Least Connections (WLC) is a dynamic load balancing algorithm that directs new client requests to the server with the lowest ratio of active connections to its assigned capacity weight. Unlike the basic Least Connections method, which treats all servers equally, WLC accounts for heterogeneous server capabilities. This makes it ideal for heterogeneous fleet orchestration, where resources like autonomous mobile robots or compute instances have differing processing power, battery life, or task throughput.

The algorithm continuously monitors the active connection count on each server. When a new request arrives, it calculates a normalized load score (connections/weight) for each eligible server and selects the one with the smallest score. This ensures higher-capacity servers receive proportionally more traffic, optimizing overall resource utilization and preventing weaker nodes from becoming overloaded. It is commonly implemented in application load balancers and orchestration middleware for managing mixed fleets in logistics and warehousing.

LOAD BALANCING ALGORITHMS

Key Features of Weighted Least Connections

Weighted Least Connections is a dynamic load balancing algorithm that selects the server with the lowest number of active connections relative to its assigned capacity weight. It is designed for heterogeneous server environments where resources have differing processing capabilities.

01

Dynamic Weighted Decision

Unlike static algorithms, Weighted Least Connections makes routing decisions in real-time based on the current connection load of each server. It calculates an effective load by dividing the server's current active connections by its assigned weight. The server with the lowest resulting ratio receives the next request. This ensures traffic is distributed proportionally to each server's capacity, not just its raw connection count.

02

Heterogeneous Fleet Support

This algorithm is specifically engineered for environments with non-identical resources. Servers are assigned a capacity weight (e.g., 1, 2, 5) representing their relative processing power, memory, or CPU cores. A high-weight server can handle more concurrent connections than a low-weight one before being considered "loaded." This is critical for heterogeneous fleet orchestration, where modern warehouses may mix high-capacity autonomous mobile robots with lower-capacity manual vehicles or legacy equipment.

03

Prevents Resource Saturation

By continuously monitoring active connections, the algorithm prevents overloading individual servers. It inherently accounts for long-lived connections (common in database sessions or file transfers) that can tie up resources. This proactive distribution helps maintain system stability, minimizes response time latency, and prevents cascading failures that can occur when a single node becomes a bottleneck.

04

Integration with Health Checks

For effective operation, Weighted Least Connections is always paired with a health check subsystem. Before being eligible for new connections, a server must pass periodic health probes. If a server fails, its weight is effectively set to zero, and it is removed from the decision pool. This integration ensures traffic is only directed to healthy, responsive nodes, maintaining overall service availability and aligning with high-availability architectures like active-active clusters.

05

Comparison to Sibling Algorithms

  • vs. Least Connections: The base Least Connections algorithm treats all servers equally. Weighted Least Connections adds the capacity dimension, making it superior for mixed-resource environments.
  • vs. Round Robin/Weighted Round Robin: Round Robin distributes requests sequentially without regard to current load. Weighted Least Connections is load-aware, leading to more efficient utilization under variable traffic conditions.
  • vs. Least Response Time: While both are dynamic, Least Response Time incorporates latency metrics. Weighted Least Connections focuses purely on connection load, making it simpler and often more predictable for connection-bound workloads.
06

Use Cases in Physical Orchestration

In heterogeneous fleet orchestration, this algorithm maps directly to task assignment. Each robot or vehicle is a "server" with a weight based on its speed, battery capacity, or payload. The "connections" are assigned tasks or navigation segments. The orchestrator assigns a new task to the agent with the fewest current tasks relative to its capability, ensuring efficient use of the entire mixed fleet and preventing faster agents from being idle while slower ones are overwhelmed.

LOAD BALANCING ALGORITHM COMPARISON

Weighted Least Connections vs. Other Algorithms

A feature and performance comparison of the Weighted Least Connections algorithm against other common load balancing methods, focusing on criteria relevant to heterogeneous fleet orchestration and dynamic task allocation.

Algorithm Feature / MetricWeighted Least ConnectionsRound RobinLeast ConnectionsIP Hash

Core Decision Logic

Lowest (Active Connections / Weight)

Sequential rotation

Lowest absolute active connections

Hash of client source IP

Dynamic Load Awareness

Heterogeneous Server Support

Session Persistence Guarantee

Optimal For Long-Lived Connections

Implementation Complexity

Medium

Low

Medium

Low

Typical Use Case

Mixed-capacity servers, fleet orchestration

Homogeneous server pools

Homogeneous servers with variable connection times

Stateful applications requiring sticky sessions

Reaction Time to Load Changes

< 1 sec

N/A (static)

< 1 sec

N/A (static)

HETEROGENEOUS FLEET ORCHESTRATION

Use Cases and Examples

Weighted Least Connections is a dynamic load balancing algorithm critical for managing heterogeneous fleets where agents have different processing capacities. It ensures efficient workload distribution by considering both current load and predefined capacity weights.

01

Warehouse Robot Fleet Management

In a logistics center, a mixed fleet of Autonomous Mobile Robots (AMRs) and Automated Guided Vehicles (AGVs) have different payload capacities and battery efficiencies. A high-capacity AMR might have a weight of 10, while a standard AGV has a weight of 5. The orchestrator uses Weighted Least Connections to assign new pick-and-place tasks not simply to the robot with the fewest active tasks, but to the one with the lowest ratio of active tasks to its capacity weight. This prevents underutilizing high-capacity assets and overloading smaller ones.

  • Key Metric: Assigns tasks based on (Active Connections / Capacity Weight).
  • Result: Maximizes throughput by aligning task complexity with robot capability.
02

Cloud Microservices with Heterogeneous Instances

A backend service pool contains a mix of instance types: compute-optimized (weight 8), memory-optimized (weight 6), and general-purpose (weight 4). An Application Load Balancer (ALB) implementing Weighted Least Connections directs new API requests. A general-purpose instance with 2 active connections (2/4 = 0.5) is preferred over a compute-optimized instance with 5 connections (5/8 = 0.625), even though the latter has more raw power. This fine-grained distribution prevents smaller instances from becoming a bottleneck while fully leveraging powerful ones.

  • Key Benefit: Achieves true proportional load distribution across asymmetric hardware.
03

Edge Computing & IoT Data Processing

An edge network processes sensor data from factory floors using nodes with varying capabilities: powerful edge servers (weight 9), gateway devices (weight 3), and constrained IoT hubs (weight 1). A streaming platform uses this algorithm to route telemetry processing jobs. It continuously evaluates the load ratio on each node, ensuring data from critical sensors is never routed to a saturated, low-capacity hub, maintaining low latency for high-priority data streams.

  • Use Case: Prioritizes system stability and real-time processing in resource-constrained, heterogeneous environments.
04

Multi-Agent System (MAS) Task Allocation

In a Multi-Agent System simulating a delivery network, different software agents have specialized skills: route planning (CPU-intensive, weight 7), object recognition (GPU-intensive, weight 8), and communication handling (I/O-intensive, weight 5). The system's orchestration middleware uses Weighted Least Connections to assign new subtasks. An object recognition agent with 6 active tasks is considered more loaded (6/8 = 0.75) than a route planner with 4 (4/7 ≈ 0.57), ensuring tasks are balanced according to each agent's specialized resource profile.

  • Outcome: Enables efficient collaboration in heterogeneous agent teams by respecting functional capacity.
05

Comparison with Sibling Algorithms

Understanding when to use Weighted Least Connections versus other load balancing strategies is key for system architects.

  • vs. Round Robin/Weighted Round Robin: These are static and distribute requests blindly in a cycle, ignoring the current live load on each server. Weighted Least Connections is dynamic and reactive.
  • vs. Least Connections: The standard Least Connections algorithm treats all servers as equal. It would overload a low-capacity server with the same number of connections as a high-capacity one. Weighted Least Connections solves this by introducing capacity weights.
  • vs. Least Response Time: This algorithm factors in server health and performance latency but does not inherently account for predefined capacity differences. They are often used in conjunction for optimal routing.
06

Implementation in Modern Orchestrators

This algorithm is a standard feature in industrial and software orchestration platforms.

  • Kubernetes & Ingress Controllers: Ingress controllers like NGINX and Traefik can be configured with nginx.ingress.kubernetes.io/load-balance annotation to use the ewma (Exponentially Weighted Moving Average) method, which is a sophisticated variant combining least connections and response time, often supporting weights.
  • HAProxy: Uses the leastconn load-balancing algorithm, and server weights can be configured via the weight parameter in the backend server definitions to achieve Weighted Least Connections behavior.
  • Cloud Load Balancers: Services like Amazon ELB (now ALB/NLB) and Google Cloud Load Balancing implement similar dynamic, capacity-aware routing logic internally, though the specific weighting may be tied to instance health and capacity metrics.
WEIGHTED LEAST CONNECTIONS

Frequently Asked Questions

Weighted Least Connections is a dynamic load balancing algorithm that intelligently distributes new requests to the server with the fewest active connections relative to its assigned capacity weight. This FAQ addresses common technical questions about its operation, use cases, and implementation.

Weighted Least Connections is a dynamic load balancing algorithm that selects the server with the lowest ratio of active connections to its assigned capacity weight. It works by first tracking the real-time active connection count on each server in the pool. When a new request arrives, the load balancer calculates a normalized score for each server by dividing its current connection count by its pre-configured weight. The server with the lowest resulting score is selected to handle the new request. This method accounts for heterogeneous server capacities, ensuring a more powerful server (e.g., weight=3) can handle proportionally more connections than a less powerful one (e.g., weight=1) before being considered equally loaded.

Key Mechanism:

  • Dynamic State Tracking: Continuously monitors the active_connections per server.
  • Weighted Normalization: Computes load_score = active_connections / server_weight.
  • Selection: Routes the request to the server with the minimum load_score.

Example: If Server A (weight=2) has 4 active connections and Server B (weight=1) has 3 active connections, their normalized scores are 2.0 and 3.0 respectively. Despite having more raw connections, Server A is selected because its load relative to capacity is lower.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.