Armeria: Is it possible to make gRPC stubs share a gRPC channel with the client factory of Armeria?

Created on 6 Sep 2019  路  3Comments  路  Source: line/armeria

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!

question

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.

All 3 comments

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sunning9001 picture sunning9001  路  5Comments

ikhoon picture ikhoon  路  5Comments

Boozilla picture Boozilla  路  4Comments

liemle3893 picture liemle3893  路  4Comments

minwoox picture minwoox  路  4Comments