Connecting to multiple servers from a single client

65 views
Skip to first unread message

Gautham Bhat

unread,
Sep 16, 2019, 1:22:42 AM9/16/19
to grpc.io

Hi All, 
I have an use case where a client connects to multiple servers, how can I achieve this? Is it possible to use single channel for multiple server connections ? Can someone please help. I am using C++.

Lidi Zheng

unread,
Sep 18, 2019, 1:33:04 PM9/18/19
to grpc.io
Yes. By "multiple servers", if you mean multiple backends of the same service, then it is possible. You can achieve this by:
1. Resolve the backend endpoint URL to multiple backend IP.
2. Set the load balance policy to "round_robin".

Gautham Bhat

unread,
Sep 18, 2019, 1:53:04 PM9/18/19
to Lidi Zheng, grpc.io
I don't want to use the load balancing policy,  my use case is to connect to different systems. Is it possible to connect through single stub and channel? 

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/7da8f049-d820-401f-b331-50207adbd135%40googlegroups.com.

Lidi Zheng

unread,
Sep 18, 2019, 2:25:35 PM9/18/19
to Gautham Bhat, grpc.io
What's the down side of creating multiple channels in your case? Can you describe more about your use case?

Gautham Bhat

unread,
Sep 18, 2019, 2:30:46 PM9/18/19
to Lidi Zheng, grpc.io
I need to have a multiple servers(not back-end)  how can I connect from one client to multiple servers easily. The usual way is by creating stubs to each servers(sepearte channel to each server) other than this any other way of achieving this,  

matt.m...@lucidworks.com

unread,
Oct 11, 2019, 8:47:17 AM10/11/19
to grpc.io
Are you saying you want "connections" to multiple servers available at the same time vs only 1 server at a time (load balancing etc.)? If so, then yes, a channel per server is the way. What are you trying to achieve though (in terms use case)?


On Wednesday, September 18, 2019 at 2:30:46 PM UTC-4, Gautham Bhat wrote:
I need to have a multiple servers(not back-end)  how can I connect from one client to multiple servers easily. The usual way is by creating stubs to each servers(sepearte channel to each server) other than this any other way of achieving this,  

On Wed, Sep 18, 2019, 11:55 PM 'Lidi Zheng' via grpc.io <grp...@googlegroups.com> wrote:
What's the down side of creating multiple channels in your case? Can you describe more about your use case?

On Wed, Sep 18, 2019 at 10:53 AM Gautham Bhat <gautha...@gmail.com> wrote:
I don't want to use the load balancing policy,  my use case is to connect to different systems. Is it possible to connect through single stub and channel? 

On Wed, Sep 18, 2019, 11:03 PM 'Lidi Zheng' via grpc.io <grp...@googlegroups.com> wrote:
Yes. By "multiple servers", if you mean multiple backends of the same service, then it is possible. You can achieve this by:
1. Resolve the backend endpoint URL to multiple backend IP.
2. Set the load balance policy to "round_robin".

You can take a look at the C++ example https://github.com/grpc/grpc/tree/master/examples/cpp/load_balancing.

On Sunday, September 15, 2019 at 10:22:42 PM UTC-7, Gautham Bhat wrote:

Hi All, 
I have an use case where a client connects to multiple servers, how can I achieve this? Is it possible to use single channel for multiple server connections ? Can someone please help. I am using C++.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages