From f8d18bf659578ce6f8f4e6e4d50e66df8087d2c1 Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Wed, 12 Jun 2019 17:08:02 +0800 Subject: [PATCH] Fixed number of worker thread (#518) --- conf/nebula-graphd.conf.default | 4 +++- src/daemons/GraphDaemon.cpp | 2 +- src/executor/GraphFlags.cpp | 1 + src/executor/GraphFlags.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conf/nebula-graphd.conf.default b/conf/nebula-graphd.conf.default index 6d1017a6..5344c272 100644 --- a/conf/nebula-graphd.conf.default +++ b/conf/nebula-graphd.conf.default @@ -36,8 +36,10 @@ --session_idle_timeout_secs=60000 # The number of threads to accept incoming connections --num_accept_threads=1 -# The number of networking IO threads to process request and return response. +# The number of networking IO threads --num_netio_threads=1 +# The number of threads to execute user queries +--num_worker_threads=1 # HTTP service port --ws_http_port=13000 # HTTP2 service port diff --git a/src/daemons/GraphDaemon.cpp b/src/daemons/GraphDaemon.cpp index c5508152..34b688bd 100644 --- a/src/daemons/GraphDaemon.cpp +++ b/src/daemons/GraphDaemon.cpp @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) { gServer->setIdleTimeout(std::chrono::seconds(FLAGS_client_idle_timeout_secs)); // TODO(dutor) This only take effects on NORMAL priority threads - gServer->setNumCPUWorkerThreads(1); + gServer->setNumCPUWorkerThreads(FLAGS_num_worker_threads); gServer->setCPUWorkerThreadName("executor"); gServer->setNumAcceptThreads(FLAGS_num_accept_threads); diff --git a/src/executor/GraphFlags.cpp b/src/executor/GraphFlags.cpp index e951faf0..a9d2afbe 100644 --- a/src/executor/GraphFlags.cpp +++ b/src/executor/GraphFlags.cpp @@ -16,6 +16,7 @@ DEFINE_int32(session_reclaim_interval_secs, 10, "Period we try to reclaim expire DEFINE_int32(num_netio_threads, 0, "Number of networking threads, 0 for number of physical CPU cores"); DEFINE_int32(num_accept_threads, 1, "Number of threads to accept incoming connections"); +DEFINE_int32(num_worker_threads, 1, "Number of threads to execute user queries"); DEFINE_bool(reuse_port, true, "Whether to turn on the SO_REUSEPORT option"); DEFINE_int32(listen_backlog, 1024, "Backlog of the listen socket"); DEFINE_string(listen_netdev, "any", "The network device to listen on"); diff --git a/src/executor/GraphFlags.h b/src/executor/GraphFlags.h index ebd10f4c..446213f5 100644 --- a/src/executor/GraphFlags.h +++ b/src/executor/GraphFlags.h @@ -15,6 +15,7 @@ DECLARE_int32(session_idle_timeout_secs); DECLARE_int32(session_reclaim_interval_secs); DECLARE_int32(num_netio_threads); DECLARE_int32(num_accept_threads); +DECLARE_int32(num_worker_threads); DECLARE_bool(reuse_port); DECLARE_int32(listen_backlog); DECLARE_string(listen_netdev); -- GitLab