Make sync server settings configurable

pull/8269/head
Sree Kuchibhotla 8 years ago
parent 892dbf4d95
commit a7a21d2049
  1. 13
      src/cpp/server/server_builder.cc
  2. 2
      test/cpp/rpcmanager/grpc_rpc_manager_test.cc
  3. 2
      test/cpp/rpcmanager/grpc_rpc_manager_test.h

@ -71,7 +71,6 @@ ServerBuilder::ServerBuilder()
memset(&maybe_default_compression_algorithm_, 0,
sizeof(maybe_default_compression_algorithm_));
// Sync server setting defaults
sync_server_settings_.min_pollers = 1;
sync_server_settings_.max_pollers = INT_MAX;
@ -215,14 +214,20 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
new std::vector<std::unique_ptr<ServerCompletionQueue>>());
if (has_sync_methods) {
// If the server has synchronous methods, it will need completion queues to
// handle those methods.
// This is a Sync server
gpr_log(GPR_INFO,
"Synchronous server. Num CQs: %d, Min pollers: %d, Max Pollers: "
"%d, CQ timeout (msec): %d",
sync_server_settings_.num_cqs, sync_server_settings_.min_pollers,
sync_server_settings_.max_pollers,
sync_server_settings_.cq_timeout_msec);
// Create completion queues to listen to incoming rpc requests
for (int i = 0; i < sync_server_settings_.num_cqs; i++) {
sync_server_cqs->emplace_back(new ServerCompletionQueue());
}
}
// TODO (sreek) Make the number of pollers configurable
std::unique_ptr<Server> server(new Server(
sync_server_cqs, max_receive_message_size_, &args,
sync_server_settings_.min_pollers, sync_server_settings_.max_pollers,

@ -81,7 +81,7 @@ void GrpcRpcManagerTest::DoWork(void *tag, bool ok) {
int main(int argc, char **argv) {
grpc::testing::InitTest(&argc, &argv, true);
GrpcRpcManagerTest test_rpc_manager(3, 15, 20);
GrpcRpcManagerTest test_rpc_manager(3, 15);
test_rpc_manager.Initialize();
test_rpc_manager.Wait();

@ -40,7 +40,7 @@ namespace testing {
class GrpcRpcManagerTest GRPC_FINAL : public GrpcRpcManager {
public:
GrpcRpcManagerTest(int min_pollers, int max_pollers, int max_threads)
GrpcRpcManagerTest(int min_pollers, int max_pollers)
: GrpcRpcManager(min_pollers, max_pollers), num_calls_(0){};
grpc::GrpcRpcManager::WorkStatus PollForWork(void **tag,

Loading…
Cancel
Save