When we create a managedChannelBuilder and use this to call a grpc-java service call, how many clients can we serve with this? Doesn't this channel be shutdown after individual service call? Say I have a REST interface which accepts REST calls from a browser and from within these REST Service methods, I am making grpc client calls to an independent grpc server. Also I can expect client connections in the range of [4000-5000] concurrently. How well can I make use of this managedChannelBuilder. Do I need just one? Or do I need to pool multiple channelbuilders?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Generally, I'd suggest using a single ManagedChannel
per endpoint when your code can be easily structured to share it. ManagedChannel
multiplexes RPCs and is thread-safe, so it can handle multiple RPCs concurrently.
In rarer cases of high very high throughput, it may make sense to use more than one ManagedChannel
. Eventually ManagedChannel
(or, maybe Channel
) should have support for doing this natively.