[java] how to implement load balance in grpc.

232 views
Skip to first unread message

kuizh...@gmail.com

unread,
Oct 30, 2017, 7:16:07 AM10/30/17
to grpc.io
Nowadays,I'm studing grpc. I've read the doc on the github.  http://https://github.com/grpc/grpc/blob/master/doc/load-balancing.md  But i don't find an example about how to load balance in grpc.It would be appreciated if anyone could give me an example

Carl Mastrangelo

unread,
Oct 30, 2017, 8:21:43 PM10/30/17
to grpc.io
Load Balancing comes in two parts: 

1.  The local load balancing logic
2.  The load balancing service that keeps track of all the servers you want to talk to.

I can't speak much about 2, but for 1 the logic in RoundRobinLoadBalancerFactory is a good example of how to implement your own load balancing logic.  

kuizh...@gmail.com

unread,
Oct 30, 2017, 9:17:16 PM10/30/17
to grpc.io
Thank you for your reply.
I still have no idea about it. I don't konw what should to do in grpc client and server.I read the example github.com/saturnism/grpc-java-demos/tree/master/kubernetes-lb-example
In that example ,they create  NameResolver and NameResolverProvider.Do you have a simple grpc load balance example that includes  client and server.

在 2017年10月31日星期二 UTC+8上午8:21:43,Carl Mastrangelo写道:

Carl Mastrangelo

unread,
Oct 31, 2017, 1:16:39 PM10/31/17
to grpc.io
Let's step back.  High level, what do you want to do?   
Reply all
Reply to author
Forward
0 new messages