0
votes

I have a handful of gRPC servers, and would like to chain some of the calls, so that the flow would become something like:

Client X calls Server A
  └──> Server A
           ... some processing ... < 1 >
           calls Server B
             └──> Server B
                      ... some processing ...
                      returns Result B
           receives Result B
           ... some more processing ...
           returns Result A

For this to work, I have been creating a gRPC client for Server B connection at each time Server A RPC gets called (shown with < 1 > above). I found a similar question asked here, and I understand this approach doesn't fit with the long lived connection to make use of concurrency nature discussed here.

What I didn't quite get from the above two references is when I should be creating the gRPC client. If I were to chain this even further with Server B calling Server C, etc., does each server need to generate the connection at the process start time? Does that introduce start-up dependency of each server?

Also, as a baseline, I thought using the context allows nice chaining and still keep control of those remote calls. Is this a correct usage of gPRC?

1

1 Answers

1
votes

We've improved the GoDoc for ClientConn. See: https://github.com/grpc/grpc-go/pull/3096.

Let us know what you think. Thanks.