Skip to content
Snippets Groups Projects
Commit 5e796821 authored by dutor's avatar dutor Committed by dangleptr
Browse files

Adjusted default # of threads of graphd to # of CPU cores (#1094)

parent ae1bd902
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0
# Verbose log level, 1, 2, 3, 4, the higher of the level, the more verbose of the logging
--v=4
--v=0
# Maximum seconds to buffer the log messages
--logbufsecs=0
# Whether to redirect stdout and stderr to separate output files
......@@ -36,10 +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
--num_netio_threads=1
# The number of threads to execute user queries
--num_worker_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
--ws_ip=127.0.0.1
# HTTP service port
......
......@@ -110,10 +110,24 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
if (FLAGS_num_netio_threads == 0) {
FLAGS_num_netio_threads = std::thread::hardware_concurrency();
}
if (FLAGS_num_netio_threads <= 0) {
LOG(WARNING) << "Number of networking IO threads should be greater than zero";
return EXIT_FAILURE;
}
LOG(INFO) << "Number of networking IO threads: " << FLAGS_num_netio_threads;
if (FLAGS_num_worker_threads == 0) {
FLAGS_num_worker_threads = std::thread::hardware_concurrency();
}
if (FLAGS_num_worker_threads <= 0) {
LOG(WARNING) << "Number of worker threads should be greater than zero";
return EXIT_FAILURE;
}
LOG(INFO) << "Number of worker threads: " << FLAGS_num_worker_threads;
auto threadFactory = std::make_shared<folly::NamedThreadFactory>("graph-netio");
auto ioThreadPool = std::make_shared<folly::IOThreadPoolExecutor>(
FLAGS_num_netio_threads, std::move(threadFactory));
......
......@@ -16,7 +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_int32(num_worker_threads, 0, "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");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment