grpc-javamanagedchannelbuilder可以处理的最大客户端数量是多少? [英] What is the maximum number of clients that a grpc-java managedchannelbuilder can handle?
问题描述
当我们创建ManagedChannelBuilder并使用它来调用grpc-java服务调用时,我们可以为多少个客户提供服务?个别服务呼叫结束后,该频道是否会关闭? 假设我有一个REST接口,可以接受来自浏览器的REST调用 从这些REST服务方法中,我正在对独立的grpc服务器进行grpc客户端调用.我也可以期望客户端连接同时在[4000-5000]范围内. 我如何充分利用此managedChannelBuilder.我只需要一个吗?还是我需要合并多个channelbuilders?
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?
推荐答案
通常,当您的代码可以很容易地结构化以共享它时,建议每个端点使用一个ManagedChannel
. ManagedChannel
多路复用RPC,并且是线程安全的,因此它可以同时处理多个RPC.
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.
在极高吞吐量的极少数情况下,使用多个ManagedChannel
可能很有意义. 最终 ManagedChannel
(或者也许是Channel
)应该支持在本地执行此操作
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.
这篇关于grpc-javamanagedchannelbuilder可以处理的最大客户端数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!