Hi Armeria team!
I want to know how I can create multiple gPRC stubs with a single shared gRPC channel.
AFAIK, gRPC channel is a heavy object, so creating a channel for an application is recommended. (Maybe I'm wrong)
https://github.com/grpc/grpc-java/issues/3268#issuecomment-317484178
But the client factory methods of Armeria, let's say GrpcClientFactory::newClient, seems to create a channel and stub together. Did I miss sth?
I think it will be great if we can share a gRPC channel among all service stubs in an application!
Upstream gRPC channels have a lot of state associated like event loops.
But Armeria channels are very simple wrapper objects that use other Armeria business logic to implement gRPC. The channels use a shared clientfactory, which is Armeria's equivalent of the heavyweight aspects of the upstream netty channel, so there isn't a real efficiency penalty for having multiple of them.
Thanks a million for you kind explanation!
Let us know if you have any other questions :)
Most helpful comment
Upstream gRPC channels have a lot of state associated like event loops.
But Armeria channels are very simple wrapper objects that use other Armeria business logic to implement gRPC. The channels use a shared clientfactory, which is Armeria's equivalent of the heavyweight aspects of the upstream netty channel, so there isn't a real efficiency penalty for having multiple of them.