spring-cloud / spring-cloud/spring-cloud-commons

Support per-service load balancing strategy configuration in Spring Cloud LoadBalancer

Open
#1,515 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Is your feature request related to a problem? Please describe.
I want to configure different load balancing strategies (e.g., roundrobin, random, or custom) for different services individually. Currently, I’m not sure if Spring Cloud LoadBalancer supports per-service strategy configuration similar to spring.cloud.loadbalancer.clients..configurations. Without this, I have to apply a global strategy for all services, which is not flexible enough for my use case.

Describe the solution you'd like
I would like to be able to specify the load balancing strategy on a per-service basis via configuration, for example:

spring:
  cloud:
    loadbalancer:
      clients:
        serviceA:
          strategy: roundrobin
        serviceB:
          strategy: random

or a similar approach that allows assigning different built-in or custom load balancing strategies to each service.

Describe alternatives you've considered
Currently, I can only configure a global load balancing strategy for all services or implement custom logic programmatically, which is more complex and less convenient than a configuration-based approach.

Additional context
This feature would improve flexibility and make it easier to tailor load balancing behavior per service, especially in microservice architectures where different services may have different load balancing requirements.

If possible, I would be happy to try implementing this feature and contribute a PR.

Thanks for your consideration!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by reviewing the existing global load-balancing strategy configuration and the spring.cloud.loadbalancer.clients..configurations pattern, then determine how per-service built-in and custom strategies should be selected. Done means service-specific configuration works while existing global behavior remains supported, with coverage for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.