我在src / cpp / server / server_builder.cc中阅读了ServerBuilder :: BuildAndStart()函数的代码,其中包括以下代码:
// cqs_ contains the completion queue added by calling the ServerBuilder's
// AddCompletionQueue() API. Some of them may not be frequently polled (i.e by
// calling Next() or AsyncNext()) and hence are not safe to be used for
// listening to incoming channels. Such completion queues must be registered
// as non-listening queues
for (auto it = cqs_.begin(); it != cqs_.end(); ++it) {
grpc_server_register_completion_queue(server->server_, (*it)->cq(),
nullptr);
}
这意味着RPC服务器在初始化期间创建多个CQ。那么,什么决定了创建的CQ数量呢?每个CQ是否有必要处理来自每个不同客户端的请求?