diff options
21 files changed, 262 insertions, 306 deletions
@@ -1270,9 +1270,9 @@ cc_library( "src/cpp/server/secure_server_credentials.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/rpcmanager/grpc_rpc_manager.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", + "src/cpp/thread_manager/thread_manager.h", "src/cpp/client/insecure_credentials.cc", "src/cpp/client/secure_credentials.cc", "src/cpp/common/auth_property_iterator.cc", @@ -1293,7 +1293,6 @@ cc_library( "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", "src/cpp/common/rpc_method.cc", - "src/cpp/rpcmanager/grpc_rpc_manager.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", @@ -1302,6 +1301,7 @@ cc_library( "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", "src/cpp/server/server_posix.cc", + "src/cpp/thread_manager/thread_manager.cc", "src/cpp/util/byte_buffer_cc.cc", "src/cpp/util/slice_cc.cc", "src/cpp/util/status.cc", @@ -1499,9 +1499,9 @@ cc_library( srcs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/rpcmanager/grpc_rpc_manager.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", + "src/cpp/thread_manager/thread_manager.h", "src/cpp/client/insecure_credentials.cc", "src/cpp/common/insecure_create_auth_context.cc", "src/cpp/server/insecure_server_credentials.cc", @@ -1517,7 +1517,6 @@ cc_library( "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", "src/cpp/common/rpc_method.cc", - "src/cpp/rpcmanager/grpc_rpc_manager.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", @@ -1526,6 +1525,7 @@ cc_library( "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", "src/cpp/server/server_posix.cc", + "src/cpp/thread_manager/thread_manager.cc", "src/cpp/util/byte_buffer_cc.cc", "src/cpp/util/slice_cc.cc", "src/cpp/util/status.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b6f4f96c2..f814407362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1025,7 +1025,6 @@ add_library(grpc++ src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc src/cpp/common/rpc_method.cc - src/cpp/rpcmanager/grpc_rpc_manager.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc src/cpp/server/dynamic_thread_pool.cc @@ -1034,6 +1033,7 @@ add_library(grpc++ src/cpp/server/server_context.cc src/cpp/server/server_credentials.cc src/cpp/server/server_posix.cc + src/cpp/thread_manager/thread_manager.cc src/cpp/util/byte_buffer_cc.cc src/cpp/util/slice_cc.cc src/cpp/util/status.cc @@ -1280,7 +1280,6 @@ add_library(grpc++_unsecure src/cpp/common/completion_queue_cc.cc src/cpp/common/core_codegen.cc src/cpp/common/rpc_method.cc - src/cpp/rpcmanager/grpc_rpc_manager.cc src/cpp/server/async_generic_service.cc src/cpp/server/create_default_thread_pool.cc src/cpp/server/dynamic_thread_pool.cc @@ -1289,6 +1288,7 @@ add_library(grpc++_unsecure src/cpp/server/server_context.cc src/cpp/server/server_credentials.cc src/cpp/server/server_posix.cc + src/cpp/thread_manager/thread_manager.cc src/cpp/util/byte_buffer_cc.cc src/cpp/util/slice_cc.cc src/cpp/util/status.cc @@ -1050,7 +1050,6 @@ grpc_node_plugin: $(BINDIR)/$(CONFIG)/grpc_node_plugin grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin grpc_php_plugin: $(BINDIR)/$(CONFIG)/grpc_php_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin -grpc_rpc_manager_test: $(BINDIR)/$(CONFIG)/grpc_rpc_manager_test grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test @@ -1078,6 +1077,7 @@ shutdown_test: $(BINDIR)/$(CONFIG)/shutdown_test status_test: $(BINDIR)/$(CONFIG)/status_test streaming_throughput_test: $(BINDIR)/$(CONFIG)/streaming_throughput_test stress_test: $(BINDIR)/$(CONFIG)/stress_test +thread_manager_test: $(BINDIR)/$(CONFIG)/thread_manager_test thread_stress_test: $(BINDIR)/$(CONFIG)/thread_stress_test public_headers_must_be_c89: $(BINDIR)/$(CONFIG)/public_headers_must_be_c89 boringssl_aes_test: $(BINDIR)/$(CONFIG)/boringssl_aes_test @@ -1420,7 +1420,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/generic_end2end_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ $(BINDIR)/$(CONFIG)/grpc_cli \ - $(BINDIR)/$(CONFIG)/grpc_rpc_manager_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_test \ @@ -1447,6 +1446,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/status_test \ $(BINDIR)/$(CONFIG)/streaming_throughput_test \ $(BINDIR)/$(CONFIG)/stress_test \ + $(BINDIR)/$(CONFIG)/thread_manager_test \ $(BINDIR)/$(CONFIG)/thread_stress_test \ $(BINDIR)/$(CONFIG)/boringssl_aes_test \ $(BINDIR)/$(CONFIG)/boringssl_asn1_test \ @@ -1508,7 +1508,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/generic_end2end_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ $(BINDIR)/$(CONFIG)/grpc_cli \ - $(BINDIR)/$(CONFIG)/grpc_rpc_manager_test \ $(BINDIR)/$(CONFIG)/grpc_tool_test \ $(BINDIR)/$(CONFIG)/grpclb_api_test \ $(BINDIR)/$(CONFIG)/grpclb_test \ @@ -1535,6 +1534,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/status_test \ $(BINDIR)/$(CONFIG)/streaming_throughput_test \ $(BINDIR)/$(CONFIG)/stress_test \ + $(BINDIR)/$(CONFIG)/thread_manager_test \ $(BINDIR)/$(CONFIG)/thread_stress_test \ endif @@ -1809,8 +1809,6 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/generic_end2end_test || ( echo test generic_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing golden_file_test" $(Q) $(BINDIR)/$(CONFIG)/golden_file_test || ( echo test golden_file_test failed ; exit 1 ) - $(E) "[RUN] Testing grpc_rpc_manager_test" - $(Q) $(BINDIR)/$(CONFIG)/grpc_rpc_manager_test || ( echo test grpc_rpc_manager_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_tool_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_tool_test || ( echo test grpc_tool_test failed ; exit 1 ) $(E) "[RUN] Testing grpclb_api_test" @@ -1841,6 +1839,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/status_test || ( echo test status_test failed ; exit 1 ) $(E) "[RUN] Testing streaming_throughput_test" $(Q) $(BINDIR)/$(CONFIG)/streaming_throughput_test || ( echo test streaming_throughput_test failed ; exit 1 ) + $(E) "[RUN] Testing thread_manager_test" + $(Q) $(BINDIR)/$(CONFIG)/thread_manager_test || ( echo test thread_manager_test failed ; exit 1 ) $(E) "[RUN] Testing thread_stress_test" $(Q) $(BINDIR)/$(CONFIG)/thread_stress_test || ( echo test thread_stress_test failed ; exit 1 ) @@ -3605,7 +3605,6 @@ LIBGRPC++_SRC = \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ src/cpp/common/rpc_method.cc \ - src/cpp/rpcmanager/grpc_rpc_manager.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ @@ -3614,6 +3613,7 @@ LIBGRPC++_SRC = \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ src/cpp/server/server_posix.cc \ + src/cpp/thread_manager/thread_manager.cc \ src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/slice_cc.cc \ src/cpp/util/status.cc \ @@ -4136,7 +4136,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ src/cpp/common/rpc_method.cc \ - src/cpp/rpcmanager/grpc_rpc_manager.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ @@ -4145,6 +4144,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ src/cpp/server/server_posix.cc \ + src/cpp/thread_manager/thread_manager.cc \ src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/slice_cc.cc \ src/cpp/util/status.cc \ @@ -11807,49 +11807,6 @@ ifneq ($(NO_DEPS),true) endif -GRPC_RPC_MANAGER_TEST_SRC = \ - test/cpp/rpcmanager/grpc_rpc_manager_test.cc \ - -GRPC_RPC_MANAGER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RPC_MANAGER_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/grpc_rpc_manager_test: openssl_dep_error - -else - - - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/grpc_rpc_manager_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/grpc_rpc_manager_test: $(PROTOBUF_DEP) $(GRPC_RPC_MANAGER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(GRPC_RPC_MANAGER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpc_rpc_manager_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/test/cpp/rpcmanager/grpc_rpc_manager_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a - -deps_grpc_rpc_manager_test: $(GRPC_RPC_MANAGER_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GRPC_RPC_MANAGER_TEST_OBJS:.o=.dep) -endif -endif - - GRPC_RUBY_PLUGIN_SRC = \ src/compiler/ruby_plugin.cc \ @@ -13046,6 +13003,49 @@ $(OBJDIR)/$(CONFIG)/test/cpp/interop/stress_test.o: $(GENDIR)/src/proto/grpc/tes $(OBJDIR)/$(CONFIG)/test/cpp/util/metrics_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/metrics.pb.cc $(GENDIR)/src/proto/grpc/testing/metrics.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc +THREAD_MANAGER_TEST_SRC = \ + test/cpp/thread_manager/thread_manager_test.cc \ + +THREAD_MANAGER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(THREAD_MANAGER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/thread_manager_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/thread_manager_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/thread_manager_test: $(PROTOBUF_DEP) $(THREAD_MANAGER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(THREAD_MANAGER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/thread_manager_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/thread_manager/thread_manager_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + +deps_thread_manager_test: $(THREAD_MANAGER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(THREAD_MANAGER_TEST_OBJS:.o=.dep) +endif +endif + + THREAD_STRESS_TEST_SRC = \ test/cpp/end2end/thread_stress_test.cc \ diff --git a/build.yaml b/build.yaml index 666e83c700..baf1eb9bd0 100644 --- a/build.yaml +++ b/build.yaml @@ -713,9 +713,9 @@ filegroups: headers: - src/cpp/client/create_channel_internal.h - src/cpp/common/channel_filter.h - - src/cpp/rpcmanager/grpc_rpc_manager.h - src/cpp/server/dynamic_thread_pool.h - src/cpp/server/thread_pool_interface.h + - src/cpp/thread_manager/thread_manager.h src: - src/cpp/client/channel_cc.cc - src/cpp/client/client_context.cc @@ -729,7 +729,6 @@ filegroups: - src/cpp/common/completion_queue_cc.cc - src/cpp/common/core_codegen.cc - src/cpp/common/rpc_method.cc - - src/cpp/rpcmanager/grpc_rpc_manager.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/create_default_thread_pool.cc - src/cpp/server/dynamic_thread_pool.cc @@ -738,6 +737,7 @@ filegroups: - src/cpp/server/server_context.cc - src/cpp/server/server_credentials.cc - src/cpp/server/server_posix.cc + - src/cpp/thread_manager/thread_manager.cc - src/cpp/util/byte_buffer_cc.cc - src/cpp/util/slice_cc.cc - src/cpp/util/status.cc @@ -2895,18 +2895,6 @@ targets: secure: false vs_config_type: Application vs_project_guid: '{DF52D501-A6CF-4E6F-BA38-6EBE2E8DAFB2}' -- name: grpc_rpc_manager_test - build: test - language: c++ - headers: - - test/cpp/rpcmanager/grpc_rpc_manager_test.h - src: - - test/cpp/rpcmanager/grpc_rpc_manager_test.cc - deps: - - grpc++ - - grpc - - gpr - - grpc++_test_config - name: grpc_ruby_plugin build: protoc language: c++ @@ -3337,6 +3325,18 @@ targets: - gpr_test_util - gpr - grpc++_test_config +- name: thread_manager_test + build: test + language: c++ + headers: + - test/cpp/thread_manager/thread_manager_test.h + src: + - test/cpp/thread_manager/thread_manager_test.cc + deps: + - grpc++ + - grpc + - gpr + - grpc++_test_config - name: thread_stress_test gtest: true cpu_cost: 100 diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 7753013c39..99b5975847 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -107,11 +107,11 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { class AsyncRequest; class ShutdownRequest; - /// SyncRequestManager is an implementation of GrpcRpcManager. This class is - /// responsible for polling for incoming RPCs and calling the RPC handlers. + /// SyncRequestThreadManager is an implementation of ThreadManager. This class + /// is responsible for polling for incoming RPCs and calling the RPC handlers. /// This is only used in case of a Sync server (i.e a server exposing a sync /// interface) - class SyncRequestManager; + class SyncRequestThreadManager; class UnimplementedAsyncRequestContext; class UnimplementedAsyncRequest; @@ -196,8 +196,8 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>> sync_server_cqs_; - /// List of GrpcRpcManager instances (one for each cq in the sync_server_cqs) - std::vector<std::unique_ptr<SyncRequestManager>> sync_req_mgrs_; + /// List of ThreadManager instances (one for each cq in the sync_server_cqs) + std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_; // Sever status grpc::mutex mu_; @@ -205,11 +205,6 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { bool shutdown_; bool shutdown_notified_; - // TODO (sreek) : Remove num_running_cb_ and callback_cv_; - // The number of threads which are running callbacks. - // int num_running_cb_; - // grpc::condition_variable callback_cv_; - grpc::condition_variable shutdown_cv_; std::shared_ptr<GlobalCallbacks> global_callbacks_; diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 6b4ff28972..7ab41ca1f8 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -247,7 +247,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { // server // 2. cqs_: Completion queues added via AddCompletionQueue() call - // All sync cqs (if any) are frequently polled by the GrpcRpcManager + // All sync cqs (if any) are frequently polled by ThreadManager int num_frequently_polled_cqs = sync_server_cqs->size(); for (auto it = sync_server_cqs->begin(); it != sync_server_cqs->end(); ++it) { diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 761f76fa12..3352aee822 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -242,12 +242,16 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { grpc_completion_queue* cq_; }; -class Server::SyncRequestManager : public GrpcRpcManager { +// Implementation of ThreadManager. Each instance of SyncRequestThreadManager +// manages a pool of threads that poll for incoming Sync RPCs and call the +// appropriate RPC handlers +class Server::SyncRequestThreadManager : public ThreadManager { public: - SyncRequestManager(Server* server, CompletionQueue* server_cq, - std::shared_ptr<GlobalCallbacks> global_callbacks, - int min_pollers, int max_pollers, int cq_timeout_msec) - : GrpcRpcManager(min_pollers, max_pollers), + SyncRequestThreadManager(Server* server, CompletionQueue* server_cq, + std::shared_ptr<GlobalCallbacks> global_callbacks, + int min_pollers, int max_pollers, + int cq_timeout_msec) + : ThreadManager(min_pollers, max_pollers), server_(server), server_cq_(server_cq), cq_timeout_msec_(cq_timeout_msec), @@ -333,7 +337,7 @@ class Server::SyncRequestManager : public GrpcRpcManager { m->Request(server_->c_server(), server_cq_->cq()); } - GrpcRpcManager::Initialize(); + ThreadManager::Initialize(); } } @@ -367,9 +371,9 @@ Server::Server( for (auto it = sync_server_cqs_->begin(); it != sync_server_cqs_->end(); it++) { - sync_req_mgrs_.emplace_back( - new SyncRequestManager(this, (*it).get(), global_callbacks_, - min_pollers, max_pollers, sync_cq_timeout_msec)); + sync_req_mgrs_.emplace_back(new SyncRequestThreadManager( + this, (*it).get(), global_callbacks_, min_pollers, max_pollers, + sync_cq_timeout_msec)); } grpc_channel_args channel_args; @@ -509,10 +513,10 @@ void Server::ShutdownInternal(gpr_timespec deadline) { ShutdownTag shutdown_tag; // Dummy shutdown tag grpc_server_shutdown_and_notify(server_, shutdown_cq.cq(), &shutdown_tag); - // Shutdown all RpcManagers. This will try to gracefully stop all the - // threads in the RpcManagers (once they process any inflight requests) + // Shutdown all ThreadManagers. This will try to gracefully stop all the + // threads in the ThreadManagers (once they process any inflight requests) for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { - (*it)->ShutdownRpcManager(); + (*it)->Shutdown(); } shutdown_cq.Shutdown(); @@ -530,7 +534,7 @@ void Server::ShutdownInternal(gpr_timespec deadline) { // Else in case of SHUTDOWN or GOT_EVENT, it means that the server has // successfully shutdown - // Wait for threads in all RpcManagers to terminate + // Wait for threads in all ThreadManagers to terminate for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->Wait(); (*it)->ShutdownAndDrainCompletionQueue(); diff --git a/src/cpp/rpcmanager/grpc_rpc_manager.cc b/src/cpp/thread_manager/thread_manager.cc index 2d791bb159..93ccfb4d98 100644 --- a/src/cpp/rpcmanager/grpc_rpc_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -40,29 +40,28 @@ namespace grpc { -GrpcRpcManager::GrpcRpcManagerThread::GrpcRpcManagerThread( - GrpcRpcManager* rpc_mgr) - : rpc_mgr_(rpc_mgr), - thd_(new std::thread(&GrpcRpcManager::GrpcRpcManagerThread::Run, this)) {} - -void GrpcRpcManager::GrpcRpcManagerThread::Run() { - rpc_mgr_->MainWorkLoop(); - rpc_mgr_->MarkAsCompleted(this); +ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr) + : thd_mgr_(thd_mgr), + thd_(new std::thread(&ThreadManager::WorkerThread::Run, this)) {} + +void ThreadManager::WorkerThread::Run() { + thd_mgr_->MainWorkLoop(); + thd_mgr_->MarkAsCompleted(this); } -GrpcRpcManager::GrpcRpcManagerThread::~GrpcRpcManagerThread() { +ThreadManager::WorkerThread::~WorkerThread() { thd_->join(); thd_.reset(); } -GrpcRpcManager::GrpcRpcManager(int min_pollers, int max_pollers) +ThreadManager::ThreadManager(int min_pollers, int max_pollers) : shutdown_(false), num_pollers_(0), min_pollers_(min_pollers), max_pollers_(max_pollers == -1 ? INT_MAX : max_pollers), num_threads_(0) {} -GrpcRpcManager::~GrpcRpcManager() { +ThreadManager::~ThreadManager() { { std::unique_lock<grpc::mutex> lock(mu_); GPR_ASSERT(num_threads_ == 0); @@ -71,24 +70,24 @@ GrpcRpcManager::~GrpcRpcManager() { CleanupCompletedThreads(); } -void GrpcRpcManager::Wait() { +void ThreadManager::Wait() { std::unique_lock<grpc::mutex> lock(mu_); while (num_threads_ != 0) { shutdown_cv_.wait(lock); } } -void GrpcRpcManager::ShutdownRpcManager() { +void ThreadManager::Shutdown() { std::unique_lock<grpc::mutex> lock(mu_); shutdown_ = true; } -bool GrpcRpcManager::IsShutdown() { +bool ThreadManager::IsShutdown() { std::unique_lock<grpc::mutex> lock(mu_); return shutdown_; } -void GrpcRpcManager::MarkAsCompleted(GrpcRpcManagerThread* thd) { +void ThreadManager::MarkAsCompleted(WorkerThread* thd) { { std::unique_lock<grpc::mutex> list_lock(list_mu_); completed_threads_.push_back(thd); @@ -101,7 +100,7 @@ void GrpcRpcManager::MarkAsCompleted(GrpcRpcManagerThread* thd) { } } -void GrpcRpcManager::CleanupCompletedThreads() { +void ThreadManager::CleanupCompletedThreads() { std::unique_lock<grpc::mutex> lock(list_mu_); for (auto thd = completed_threads_.begin(); thd != completed_threads_.end(); thd = completed_threads_.erase(thd)) { @@ -109,7 +108,7 @@ void GrpcRpcManager::CleanupCompletedThreads() { } } -void GrpcRpcManager::Initialize() { +void ThreadManager::Initialize() { for (int i = 0; i < min_pollers_; i++) { MaybeCreatePoller(); } @@ -118,7 +117,7 @@ void GrpcRpcManager::Initialize() { // If the number of pollers (i.e threads currently blocked in PollForWork()) is // less than max threshold (i.e max_pollers_) and the total number of threads is // below the maximum threshold, we can let the current thread continue as poller -bool GrpcRpcManager::MaybeContinueAsPoller() { +bool ThreadManager::MaybeContinueAsPoller() { std::unique_lock<grpc::mutex> lock(mu_); if (shutdown_ || num_pollers_ > max_pollers_) { return false; @@ -131,18 +130,18 @@ bool GrpcRpcManager::MaybeContinueAsPoller() { // Create a new poller if the current number of pollers i.e num_pollers_ (i.e // threads currently blocked in PollForWork()) is below the threshold (i.e // min_pollers_) and the total number of threads is below the maximum threshold -void GrpcRpcManager::MaybeCreatePoller() { +void ThreadManager::MaybeCreatePoller() { grpc::unique_lock<grpc::mutex> lock(mu_); if (!shutdown_ && num_pollers_ < min_pollers_) { num_pollers_++; num_threads_++; // Create a new thread (which ends up calling the MainWorkLoop() function - new GrpcRpcManagerThread(this); + new WorkerThread(this); } } -void GrpcRpcManager::MainWorkLoop() { +void ThreadManager::MainWorkLoop() { void* tag; bool ok; @@ -170,7 +169,7 @@ void GrpcRpcManager::MainWorkLoop() { } // Note that MaybeCreatePoller does check for shutdown and creates a new - // thread only if GrpcRpcManager is not shutdown + // thread only if ThreadManager is not shutdown if (work_status == WORK_FOUND) { MaybeCreatePoller(); DoWork(tag, ok); @@ -179,7 +178,7 @@ void GrpcRpcManager::MainWorkLoop() { CleanupCompletedThreads(); - // If we are here, either GrpcRpcManager is shutting down or it already has + // If we are here, either ThreadManager is shutting down or it already has // enough threads. } diff --git a/src/cpp/rpcmanager/grpc_rpc_manager.h b/src/cpp/thread_manager/thread_manager.h index 77715c52fd..b667a645af 100644 --- a/src/cpp/rpcmanager/grpc_rpc_manager.h +++ b/src/cpp/thread_manager/thread_manager.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_INTERNAL_CPP_GRPC_RPC_MANAGER_H -#define GRPC_INTERNAL_CPP_GRPC_RPC_MANAGER_H +#ifndef GRPC_INTERNAL_CPP_THREAD_MANAGER_H +#define GRPC_INTERNAL_CPP_THREAD_MANAGER_H #include <list> #include <memory> @@ -42,10 +42,10 @@ namespace grpc { -class GrpcRpcManager { +class ThreadManager { public: - explicit GrpcRpcManager(int min_pollers, int max_pollers); - virtual ~GrpcRpcManager(); + explicit ThreadManager(int min_pollers, int max_pollers); + virtual ~ThreadManager(); // Initializes and Starts the Rpc Manager threads void Initialize(); @@ -60,17 +60,17 @@ class GrpcRpcManager { // - The implementaion MUST set the value of 'ok' to 'true' or 'false'. A // value of 'false' indicates some implemenation specific error (that is // neither SHUTDOWN nor TIMEOUT) - // - GrpcRpcManager does not interpret the values of 'tag' and 'ok' - // - GrpcRpcManager WILL call DoWork() and pass '*tag' and 'ok' as input to + // - ThreadManager does not interpret the values of 'tag' and 'ok' + // - ThreadManager WILL call DoWork() and pass '*tag' and 'ok' as input to // DoWork() // // If the return value is SHUTDOWN:, - // - GrpcManager WILL NOT call DoWork() and terminates the thead + // - ThreadManager WILL NOT call DoWork() and terminates the thead // // If the return value is TIMEOUT:, - // - GrpcManager WILL NOT call DoWork() - // - GrpcManager MAY terminate the thread depending on the current number of - // active poller threads and mix_pollers/max_pollers settings + // - ThreadManager WILL NOT call DoWork() + // - ThreadManager MAY terminate the thread depending on the current number + // of active poller threads and mix_pollers/max_pollers settings // - Also, the value of timeout is specific to the derived class // implementation virtual WorkStatus PollForWork(void** tag, bool* ok) = 0; @@ -84,40 +84,40 @@ class GrpcRpcManager { // actually finds some work virtual void DoWork(void* tag, bool ok) = 0; - // Mark the GrpcRpcManager as shutdown and begin draining the work. - // This is a non-blocking call and the caller should call Wait(), a blocking - // call which returns only once the shutdown is complete - void ShutdownRpcManager(); + // Mark the ThreadManager as shutdown and begin draining the work. This is a + // non-blocking call and the caller should call Wait(), a blocking call which + // returns only once the shutdown is complete + void Shutdown(); - // Has ShutdownRpcManager() been called + // Has Shutdown() been called bool IsShutdown(); - // A blocking call that returns only after the GrpcRpcManager has shutdown and + // A blocking call that returns only after the ThreadManager has shutdown and // all the threads have drained all the outstanding work void Wait(); private: - // Helper wrapper class around std::thread. This takes a GrpcRpcManager object + // Helper wrapper class around std::thread. This takes a ThreadManager object // and starts a new std::thread to calls the Run() function. // - // The Run() function calls GrpcManager::MainWorkLoop() function and once that - // completes, it marks the GrpcRpcManagerThread completed by calling - // GrpcRpcManager::MarkAsCompleted() - class GrpcRpcManagerThread { + // The Run() function calls ThreadManager::MainWorkLoop() function and once + // that completes, it marks the WorkerThread completed by calling + // ThreadManager::MarkAsCompleted() + class WorkerThread { public: - GrpcRpcManagerThread(GrpcRpcManager* rpc_mgr); - ~GrpcRpcManagerThread(); + WorkerThread(ThreadManager* thd_mgr); + ~WorkerThread(); private: - // Calls rpc_mgr_->MainWorkLoop() and once that completes, calls - // rpc_mgr_>MarkAsCompleted(this) to mark the thread as completed + // Calls thd_mgr_->MainWorkLoop() and once that completes, calls + // thd_mgr_>MarkAsCompleted(this) to mark the thread as completed void Run(); - GrpcRpcManager* rpc_mgr_; + ThreadManager* thd_mgr_; std::unique_ptr<grpc::thread> thd_; }; - // The main funtion in GrpcRpcManager + // The main funtion in ThreadManager void MainWorkLoop(); // Create a new poller if the number of current pollers is less than the @@ -128,7 +128,7 @@ class GrpcRpcManager { // current number of pollers is less than the max_pollers. bool MaybeContinueAsPoller(); - void MarkAsCompleted(GrpcRpcManagerThread* thd); + void MarkAsCompleted(WorkerThread* thd); void CleanupCompletedThreads(); // Protects shutdown_, num_pollers_ and num_threads_ @@ -150,9 +150,9 @@ class GrpcRpcManager { int num_threads_; grpc::mutex list_mu_; - std::list<GrpcRpcManagerThread*> completed_threads_; + std::list<WorkerThread*> completed_threads_; }; } // namespace grpc -#endif // GRPC_INTERNAL_CPP_GRPC_RPC_MANAGER_H +#endif // GRPC_INTERNAL_CPP_THREAD_MANAGER_H diff --git a/test/cpp/rpcmanager/grpc_rpc_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 85ced00d46..07fabd6bc3 100644 --- a/test/cpp/rpcmanager/grpc_rpc_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -42,7 +42,7 @@ #include "test/cpp/rpcmanager/grpc_rpc_manager_test.h" #include "test/cpp/util/test_config.h" -using grpc::testing::GrpcRpcManagerTest; +using grpc::testing::ThreadManagerTest; static const int kMinPollers = 2; static const int kMaxPollers = 10; @@ -52,8 +52,8 @@ static const int kDoWorkDurationMsec = 1; static const int kNumDoWorkIterations = 10; -grpc::GrpcRpcManager::WorkStatus GrpcRpcManagerTest::PollForWork(void **tag, - bool *ok) { +grpc::ThreadManager::WorkStatus ThreadManagerTest::PollForWork(void **tag, + bool *ok) { { std::unique_lock<grpc::mutex> lock(mu_); gpr_log(GPR_INFO, "PollForWork: Entered"); @@ -72,14 +72,14 @@ grpc::GrpcRpcManager::WorkStatus GrpcRpcManagerTest::PollForWork(void **tag, if (num_calls_ > kNumDoWorkIterations) { gpr_log(GPR_DEBUG, "PollForWork: Returning shutdown"); work_status = SHUTDOWN; - ShutdownRpcManager(); + ThreadManager::Shutdown(); } } return work_status; } -void GrpcRpcManagerTest::DoWork(void *tag, bool ok) { +void ThreadManagerTest::DoWork(void *tag, bool ok) { { std::unique_lock<grpc::mutex> lock(mu_); gpr_log(GPR_DEBUG, "DoWork()"); @@ -91,7 +91,7 @@ void GrpcRpcManagerTest::DoWork(void *tag, bool ok) { int main(int argc, char **argv) { grpc::testing::InitTest(&argc, &argv, true); - GrpcRpcManagerTest test_rpc_manager(kMinPollers, kMaxPollers); + ThreadManagerTest test_rpc_manager(kMinPollers, kMaxPollers); test_rpc_manager.Initialize(); test_rpc_manager.Wait(); diff --git a/test/cpp/rpcmanager/grpc_rpc_manager_test.h b/test/cpp/thread_manager/thread_manager_test.h index 0f1d3b3ed2..01bf52459f 100644 --- a/test/cpp/rpcmanager/grpc_rpc_manager_test.h +++ b/test/cpp/thread_manager/thread_manager_test.h @@ -30,21 +30,21 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *is % allowed in string */ -#ifndef GRPC_TEST_CPP_GRPC_RPC_MANAGER_TEST_H -#define GRPC_TEST_CPP_GRPC_RPC_MANAGER_TEST_H +#ifndef GRPC_TEST_CPP_THREAD_MANAGER_TEST_H +#define GRPC_TEST_CPP_THREAD_MANAGER_TEST_H #include "src/cpp/rpcmanager/grpc_rpc_manager.h" namespace grpc { namespace testing { -class GrpcRpcManagerTest GRPC_FINAL : public GrpcRpcManager { +class ThreadManagerTest GRPC_FINAL : public ThreadManager { public: - GrpcRpcManagerTest(int min_pollers, int max_pollers) - : GrpcRpcManager(min_pollers, max_pollers), num_calls_(0){}; + ThreadManagerTest(int min_pollers, int max_pollers) + : ThreadManager(min_pollers, max_pollers), num_calls_(0){}; - grpc::GrpcRpcManager::WorkStatus PollForWork(void **tag, - bool *ok) GRPC_OVERRIDE; + grpc::ThreadManager::WorkStatus PollForWork(void **tag, + bool *ok) GRPC_OVERRIDE; void DoWork(void *tag, bool ok) GRPC_OVERRIDE; private: @@ -55,4 +55,4 @@ class GrpcRpcManagerTest GRPC_FINAL : public GrpcRpcManager { } // namespace testing } // namespace grpc -#endif // GRPC_TEST_CPP_GRPC_RPC_MANAGER_TEST_H +#endif // GRPC_TEST_CPP_THREAD_MANAGER_TEST_H diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index dac227d077..7a95526adb 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -861,9 +861,9 @@ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ src/cpp/client/create_channel_internal.h \ src/cpp/common/channel_filter.h \ -src/cpp/rpcmanager/grpc_rpc_manager.h \ src/cpp/server/dynamic_thread_pool.h \ src/cpp/server/thread_pool_interface.h \ +src/cpp/thread_manager/thread_manager.h \ src/cpp/client/insecure_credentials.cc \ src/cpp/client/secure_credentials.cc \ src/cpp/common/auth_property_iterator.cc \ @@ -884,7 +884,6 @@ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ src/cpp/common/core_codegen.cc \ src/cpp/common/rpc_method.cc \ -src/cpp/rpcmanager/grpc_rpc_manager.cc \ src/cpp/server/async_generic_service.cc \ src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/dynamic_thread_pool.cc \ @@ -893,6 +892,7 @@ src/cpp/server/server_cc.cc \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ src/cpp/server/server_posix.cc \ +src/cpp/thread_manager/thread_manager.cc \ src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/slice_cc.cc \ src/cpp/util/status.cc \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index de7f1e1edf..7619af1105 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2529,26 +2529,6 @@ }, { "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_test_config" - ], - "headers": [ - "test/cpp/rpcmanager/grpc_rpc_manager_test.h" - ], - "is_filegroup": false, - "language": "c++", - "name": "grpc_rpc_manager_test", - "src": [ - "test/cpp/rpcmanager/grpc_rpc_manager_test.cc", - "test/cpp/rpcmanager/grpc_rpc_manager_test.h" - ], - "third_party": false, - "type": "target" - }, - { - "deps": [ "grpc_plugin_support" ], "headers": [], @@ -3134,6 +3114,26 @@ { "deps": [ "gpr", + "grpc", + "grpc++", + "grpc++_test_config" + ], + "headers": [ + "test/cpp/thread_manager/thread_manager_test.h" + ], + "is_filegroup": false, + "language": "c++", + "name": "thread_manager_test", + "src": [ + "test/cpp/thread_manager/thread_manager_test.cc", + "test/cpp/thread_manager/thread_manager_test.h" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", "gpr_test_util", "grpc", "grpc++", @@ -7269,9 +7269,9 @@ "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", - "src/cpp/rpcmanager/grpc_rpc_manager.h", "src/cpp/server/dynamic_thread_pool.h", - "src/cpp/server/thread_pool_interface.h" + "src/cpp/server/thread_pool_interface.h", + "src/cpp/thread_manager/thread_manager.h" ], "is_filegroup": true, "language": "c++", @@ -7338,8 +7338,6 @@ "src/cpp/common/completion_queue_cc.cc", "src/cpp/common/core_codegen.cc", "src/cpp/common/rpc_method.cc", - "src/cpp/rpcmanager/grpc_rpc_manager.cc", - "src/cpp/rpcmanager/grpc_rpc_manager.h", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/dynamic_thread_pool.cc", @@ -7350,6 +7348,8 @@ "src/cpp/server/server_credentials.cc", "src/cpp/server/server_posix.cc", "src/cpp/server/thread_pool_interface.h", + "src/cpp/thread_manager/thread_manager.cc", + "src/cpp/thread_manager/thread_manager.h", "src/cpp/util/byte_buffer_cc.cc", "src/cpp/util/slice_cc.cc", "src/cpp/util/status.cc", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 255cb80f15..7446aecdc1 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -2427,27 +2427,6 @@ "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, - "gtest": false, - "language": "c++", - "name": "grpc_rpc_manager_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ] - }, - { - "args": [], - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, "gtest": true, "language": "c++", "name": "grpc_tool_test", @@ -2750,6 +2729,27 @@ "posix", "windows" ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "thread_manager_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], "cpu_cost": 100, "exclude_configs": [], "flaky": false, @@ -31566,27 +31566,6 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_secure\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"core_limit\": 0, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"SYNC_SERVER\"}, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 0, \"req_size\": 0}}, \"client_channels\": 64, \"async_client_threads\": 0, \"outstanding_rpcs_per_channel\": 100, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}, \"num_clients\": 0}]}" - ], - "boringssl": true, - "ci_platforms": [ - "linux" - ], - "cpu_cost": 8, - "defaults": "boringssl", - "exclude_configs": [], - "flaky": false, - "language": "c++", - "name": "json_run_localhost", - "platforms": [ - "linux" - ], - "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_secure", - "timeout_seconds": 180 - }, - { - "args": [ - "--scenarios_json", "{\"scenarios\": [{\"name\": \"cpp_protobuf_sync_unary_ping_pong_secure\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 1, \"core_limit\": 1, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"SYNC_SERVER\"}, \"client_config\": {\"client_type\": \"SYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 0, \"req_size\": 0}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}, \"num_clients\": 1}]}" ], "boringssl": true, @@ -31818,27 +31797,6 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_insecure\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"core_limit\": 0, \"security_params\": null, \"server_type\": \"SYNC_SERVER\"}, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 0, \"req_size\": 0}}, \"client_channels\": 64, \"async_client_threads\": 0, \"outstanding_rpcs_per_channel\": 100, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}, \"num_clients\": 0}]}" - ], - "boringssl": true, - "ci_platforms": [ - "linux" - ], - "cpu_cost": 8, - "defaults": "boringssl", - "exclude_configs": [], - "flaky": false, - "language": "c++", - "name": "json_run_localhost", - "platforms": [ - "linux" - ], - "shortname": "json_run_localhost:cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_insecure", - "timeout_seconds": 180 - }, - { - "args": [ - "--scenarios_json", "{\"scenarios\": [{\"name\": \"cpp_protobuf_sync_unary_ping_pong_insecure\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 1, \"core_limit\": 1, \"security_params\": null, \"server_type\": \"SYNC_SERVER\"}, \"client_config\": {\"client_type\": \"SYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 0, \"req_size\": 0}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}, \"num_clients\": 1}]}" ], "boringssl": true, diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 509e66d00b..ad217dae7e 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -361,9 +361,9 @@ <ClInclude Include="$(SolutionDir)\..\src\cpp\server\secure_server_credentials.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\client\create_channel_internal.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\common\channel_filter.h" /> - <ClInclude Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\dynamic_thread_pool.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\thread_pool_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\insecure_credentials.cc"> @@ -406,8 +406,6 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.cc"> - </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\create_default_thread_pool.cc"> @@ -424,6 +422,8 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\server_posix.cc"> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.cc"> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\byte_buffer_cc.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\slice_cc.cc"> diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 1dd5fd90e5..d4ad8c4c97 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -61,9 +61,6 @@ <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <Filter>src\cpp\common</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.cc"> - <Filter>src\cpp\rpcmanager</Filter> - </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> <Filter>src\cpp\server</Filter> </ClCompile> @@ -88,6 +85,9 @@ <ClCompile Include="$(SolutionDir)\..\src\cpp\server\server_posix.cc"> <Filter>src\cpp\server</Filter> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.cc"> + <Filter>src\cpp\thread_manager</Filter> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\byte_buffer_cc.cc"> <Filter>src\cpp\util</Filter> </ClCompile> @@ -413,15 +413,15 @@ <ClInclude Include="$(SolutionDir)\..\src\cpp\common\channel_filter.h"> <Filter>src\cpp\common</Filter> </ClInclude> - <ClInclude Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.h"> - <Filter>src\cpp\rpcmanager</Filter> - </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\dynamic_thread_pool.h"> <Filter>src\cpp\server</Filter> </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\thread_pool_interface.h"> <Filter>src\cpp\server</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.h"> + <Filter>src\cpp\thread_manager</Filter> + </ClInclude> </ItemGroup> <ItemGroup> @@ -473,12 +473,12 @@ <Filter Include="src\cpp\common"> <UniqueIdentifier>{2336e396-7e0b-8bf9-3b09-adc6ad1f0e5b}</UniqueIdentifier> </Filter> - <Filter Include="src\cpp\rpcmanager"> - <UniqueIdentifier>{f142b1a2-5198-040b-9da4-2afc09e9248a}</UniqueIdentifier> - </Filter> <Filter Include="src\cpp\server"> <UniqueIdentifier>{321b0980-74ad-e8ca-f23b-deffa5d6bb8f}</UniqueIdentifier> </Filter> + <Filter Include="src\cpp\thread_manager"> + <UniqueIdentifier>{23f9df56-8604-52a0-e6a2-f01b8e68d0e7}</UniqueIdentifier> + </Filter> <Filter Include="src\cpp\util"> <UniqueIdentifier>{f842537a-2bf1-1ec3-b495-7d62c64a1c06}</UniqueIdentifier> </Filter> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 5ec59397ec..01940c31af 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -357,9 +357,9 @@ <ItemGroup> <ClInclude Include="$(SolutionDir)\..\src\cpp\client\create_channel_internal.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\common\channel_filter.h" /> - <ClInclude Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\dynamic_thread_pool.h" /> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\thread_pool_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\insecure_credentials.cc"> @@ -392,8 +392,6 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.cc"> - </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\create_default_thread_pool.cc"> @@ -410,6 +408,8 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\server_posix.cc"> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.cc"> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\byte_buffer_cc.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\slice_cc.cc"> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 7e5b912f21..f261c04c7d 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -46,9 +46,6 @@ <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <Filter>src\cpp\common</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.cc"> - <Filter>src\cpp\rpcmanager</Filter> - </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> <Filter>src\cpp\server</Filter> </ClCompile> @@ -73,6 +70,9 @@ <ClCompile Include="$(SolutionDir)\..\src\cpp\server\server_posix.cc"> <Filter>src\cpp\server</Filter> </ClCompile> + <ClCompile Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.cc"> + <Filter>src\cpp\thread_manager</Filter> + </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\cpp\util\byte_buffer_cc.cc"> <Filter>src\cpp\util</Filter> </ClCompile> @@ -386,15 +386,15 @@ <ClInclude Include="$(SolutionDir)\..\src\cpp\common\channel_filter.h"> <Filter>src\cpp\common</Filter> </ClInclude> - <ClInclude Include="$(SolutionDir)\..\src\cpp\rpcmanager\grpc_rpc_manager.h"> - <Filter>src\cpp\rpcmanager</Filter> - </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\dynamic_thread_pool.h"> <Filter>src\cpp\server</Filter> </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\cpp\server\thread_pool_interface.h"> <Filter>src\cpp\server</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\cpp\thread_manager\thread_manager.h"> + <Filter>src\cpp\thread_manager</Filter> + </ClInclude> </ItemGroup> <ItemGroup> @@ -446,12 +446,12 @@ <Filter Include="src\cpp\common"> <UniqueIdentifier>{ed8e4daa-825f-fbe5-2a45-846ad9165d3d}</UniqueIdentifier> </Filter> - <Filter Include="src\cpp\rpcmanager"> - <UniqueIdentifier>{cb26a5cb-4725-6fee-8abc-09d5fcd52f39}</UniqueIdentifier> - </Filter> <Filter Include="src\cpp\server"> <UniqueIdentifier>{8a54a279-d14b-4237-0df3-1ffe1ef5a7af}</UniqueIdentifier> </Filter> + <Filter Include="src\cpp\thread_manager"> + <UniqueIdentifier>{e5b55f25-d99f-b8e5-9981-7da7fa7ba628}</UniqueIdentifier> + </Filter> <Filter Include="src\cpp\util"> <UniqueIdentifier>{fb5d9a64-20ca-5119-ed38-04a3cf94923d}</UniqueIdentifier> </Filter> diff --git a/vsprojects/vcxproj/test/grpc_rpc_manager_test/grpc_rpc_manager_test.vcxproj.filters b/vsprojects/vcxproj/test/grpc_rpc_manager_test/grpc_rpc_manager_test.vcxproj.filters deleted file mode 100644 index fedaea08d3..0000000000 --- a/vsprojects/vcxproj/test/grpc_rpc_manager_test/grpc_rpc_manager_test.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <ClCompile Include="$(SolutionDir)\..\test\cpp\rpcmanager\grpc_rpc_manager_test.cc"> - <Filter>test\cpp\rpcmanager</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="$(SolutionDir)\..\test\cpp\rpcmanager\grpc_rpc_manager_test.h"> - <Filter>test\cpp\rpcmanager</Filter> - </ClInclude> - </ItemGroup> - - <ItemGroup> - <Filter Include="test"> - <UniqueIdentifier>{9da529f7-8064-34c0-54da-0fade27184ad}</UniqueIdentifier> - </Filter> - <Filter Include="test\cpp"> - <UniqueIdentifier>{b6e53cff-22ab-1194-866d-57caa3551fd2}</UniqueIdentifier> - </Filter> - <Filter Include="test\cpp\rpcmanager"> - <UniqueIdentifier>{c63d7236-e7c6-d7b7-e3d8-f25853e358e6}</UniqueIdentifier> - </Filter> - </ItemGroup> -</Project> - diff --git a/vsprojects/vcxproj/test/grpc_rpc_manager_test/grpc_rpc_manager_test.vcxproj b/vsprojects/vcxproj/test/thread_manager_test/thread_manager_test.vcxproj index 4502de8167..6de19fbf33 100644 --- a/vsprojects/vcxproj/test/grpc_rpc_manager_test/grpc_rpc_manager_test.vcxproj +++ b/vsprojects/vcxproj/test/thread_manager_test/thread_manager_test.vcxproj @@ -20,7 +20,7 @@ </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> - <ProjectGuid>{A4F24E89-1766-2FAA-9058-1094EAA018A8}</ProjectGuid> + <ProjectGuid>{08C611E4-7F87-73BE-76CE-C158A4CC05A3}</ProjectGuid> <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> <IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> </PropertyGroup> @@ -62,14 +62,14 @@ </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)'=='Debug'"> - <TargetName>grpc_rpc_manager_test</TargetName> + <TargetName>thread_manager_test</TargetName> <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)'=='Release'"> - <TargetName>grpc_rpc_manager_test</TargetName> + <TargetName>thread_manager_test</TargetName> <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> <Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> @@ -160,10 +160,10 @@ </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="$(SolutionDir)\..\test\cpp\rpcmanager\grpc_rpc_manager_test.h" /> + <ClInclude Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="$(SolutionDir)\..\test\cpp\rpcmanager\grpc_rpc_manager_test.cc"> + <ClCompile Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.cc"> </ClCompile> </ItemGroup> <ItemGroup> diff --git a/vsprojects/vcxproj/test/thread_manager_test/thread_manager_test.vcxproj.filters b/vsprojects/vcxproj/test/thread_manager_test/thread_manager_test.vcxproj.filters new file mode 100644 index 0000000000..a16d191317 --- /dev/null +++ b/vsprojects/vcxproj/test/thread_manager_test/thread_manager_test.vcxproj.filters @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.cc"> + <Filter>test\cpp\thread_manager</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(SolutionDir)\..\test\cpp\thread_manager\thread_manager_test.h"> + <Filter>test\cpp\thread_manager</Filter> + </ClInclude> + </ItemGroup> + + <ItemGroup> + <Filter Include="test"> + <UniqueIdentifier>{e9e471cd-7f7e-9abc-af13-ec58851849ac}</UniqueIdentifier> + </Filter> + <Filter Include="test\cpp"> + <UniqueIdentifier>{b350f72c-af76-7272-4342-1b0fc7a458ee}</UniqueIdentifier> + </Filter> + <Filter Include="test\cpp\thread_manager"> + <UniqueIdentifier>{6b09ea8d-fbc6-e6fe-f884-b3d3dfcbfc12}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project> + |