Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC load balancing(sharding) #14280

Closed
nragon opened this issue Jan 13, 2021 · 4 comments
Closed

gRPC load balancing(sharding) #14280

nragon opened this issue Jan 13, 2021 · 4 comments
Labels
area/grpc gRPC kind/enhancement New feature or request

Comments

@nragon
Copy link
Contributor

nragon commented Jan 13, 2021

Description
Custom grpc load balancer

Implementation ideas
One of my use cases, and I believe of many others, will involve multiple microservices to read and one(eventually multiple) to write.
Now, for this "write" microservice to scale vertically we need some kind of locking/synchronization between them all.
One of the solutions would be to implement a custom grpc load balancer to distribute the same "keys" to the same replicas of that same service.
This would imply changing the current grpc client to support multiple hosts instead of a single one.
A new property would be added(like quarkus.grpc.clients.hello.servers) where a list of server is identified. Then each implementation would register a load balancer to deal with those servers.

High level:

  • Add a new option to grpc client called "servers" (A comma delimited list of servers where the service is exposed (ex.: :,:,...))
  • Add new option to grpc client called "loadBalancer" which will map to defaultLoadBalancingPolicy to NettyChannelBuilder (default pick_first).
  • Servers will be resolver on DnsNameResolverProvider loaded by grpc core
  • Custom load balancers can be loaded with custom services (io.grpc.LoadBalancerProvider) just like PickFirstLoadBalancerProvider
@nragon nragon added the kind/enhancement New feature or request label Jan 13, 2021
@ghost ghost added the area/grpc gRPC label Jan 13, 2021
@ghost
Copy link

ghost commented Jan 13, 2021

/cc @cescoffier, @michalszynkiewicz

@michalszynkiewicz
Copy link
Member

hi @nragon:

  1. wouldn't using DnsNameResolver together with a list of servers be an overcomplication? My understanding is that the DnsNameResolver itself provides a list of addresses for a given URI.
  2. I think loadBalancingPolicy would be a better name than loadBalancer for the policy

@nragon
Copy link
Contributor Author

nragon commented Jan 14, 2021

@michalszynkiewicz

  1. Maybe that resolver is not the best to be used. Idea is to have the following config quarkus.grpc.clients.hello.servers=localhost:9000,localhost:9001,localhost:9002,.... Perhaps this point is not even necessary.
    This way we could send this list of servers to the load balancer and decide where to send the request.
  2. LGTM

@michalszynkiewicz
Copy link
Member

Looks like a duplicate of #9326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants