Load Balancing

Load Balancing

During cluster load balancing, Dubbo provides multiple balancing strategies, with the default being the weighted random strategy, which is a weight-based random load balancing strategy.

In terms of implementation, Dubbo provides client-side load balancing, meaning the Consumer determines which Provider instance to send the request to using a load balancing algorithm.

Load Balancing Strategies

Currently, Dubbo has built-in the following load balancing algorithms, which can be enabled through configuration adjustments.

Weighted Random LoadBalanceWeighted RandomDefault algorithm, default weights are the same.
RoundRobin LoadBalanceWeighted Round RobinInspired by Nginx’s smooth weighted round-robin algorithm.
LeastActive LoadBalanceLeast Active + Weighted RandomThe principle of “the more capable, the more work”.
Shortest-Response LoadBalanceShortest Response + Weighted RandomFocuses more on response speed.
ConsistentHash LoadBalanceConsistent HashingDeterministic parameters lead to a deterministic provider, suitable for stateful requests.
P2C LoadBalancePower of Two ChoiceAfter randomly selecting two nodes, choose the one with fewer “connections”.
Adaptive LoadBalanceAdaptive Load BalancingBased on P2C algorithm, chooses the node with the least load.

Weighted Random

  • Weighted Random: The probability of random selection is set according to the weight.
  • There’s a high collision probability on a cross-section, but as the call volume grows, the distribution becomes more even. After probability-based weighting, it’s also fairly even, which facilitates dynamic adjustment of provider weights.
  • Downside: There’s the problem of slow providers accumulating requests.


  • Weighted Round Robin: Calls nodes in a circular manner based on proportionate weights.
  • Downside: There’s the problem of slow providers accumulating requests.

For the weighted round robin, if a node’s weight is too large, there’s the problem of concentrated calls in a short time span.


  • Weighted Least Active: The provider with the fewest active calls is preferred. The fewer the active calls, the stronger the provider’s processing ability.
  • This ensures slower providers receive fewer requests, as slower providers will have a larger difference between requests sent and responses received.


  • Weighted Shortest Response: Providers with faster response times handle more requests.
  • Downside: This might lead to traffic concentrating too much on high-performance nodes.


  • Consistent Hashing: Requests with the same parameters are always sent to the same provider.
  • When a provider fails, the requests originally directed to that provider are spread across other providers based on virtual nodes, without causing major disruption.
  • For details, refer to: Consistent Hashing | WIKIPEDIA

P2C Load Balance

The Power of Two Choice algorithm is simple but classic.

Adaptive Load Balance

Adaptive, as the name suggests, is a self-adapting load balancing mechanism that always tries to forward requests to the least loaded node.


Dubbo allows providers to configure a default load balancing strategy so that all consumers will use the strategy specified by the provider by default. Consumers can also specify their own load balancing strategies. If neither side has any configuration, the random load balancing strategy is used by default.

Each application can configure different services to use different load balancing strategies and can even specify different strategies for different methods of the same service.

For configuration details, refer to the implementations in different languages:

Custom Extensions

Load balancing strategies support custom extension implementations. For details, please see Dubbo’s Extensibility.