Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add max connections flag #5309

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
Expand Down
3 changes: 3 additions & 0 deletions conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
--num_netio_threads=0
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# The number of threads to execute user queries, 0 for # of CPU cores
--num_worker_threads=0
# HTTP service ip
Expand Down
3 changes: 3 additions & 0 deletions conf/nebula-storaged.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
--auto_remove_invalid_space=true
# Network IO threads number
--num_io_threads=16
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# Worker threads number to handle request
--num_worker_threads=32
# Maximum subtasks to run admin jobs concurrently
Expand Down
3 changes: 3 additions & 0 deletions conf/nebula-storaged.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
--auto_remove_invalid_space=true
# Network IO threads number
--num_io_threads=16
# Max active connections for all networking threads. 0 means no limit.
# Max connections for each networking thread = num_max_connections / num_netio_threads
--num_max_connections=0
# Worker threads number to handle request
--num_worker_threads=32
# Maximum subtasks to run admin jobs concurrently
Expand Down
4 changes: 4 additions & 0 deletions src/graph/service/GraphFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ DEFINE_int32(num_netio_threads,
0,
"The 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_uint32(num_max_connections,
0,
"Max active connections for all networking threads. 0 means no limit. Max active "
"connections for each networking thread = num_max_connections / num_netio_threads");
DEFINE_int32(num_worker_threads, 0, "Number of threads to execute user queries");
DEFINE_int32(num_operator_threads, 2, "Number of threads to execute a single operator");
DEFINE_bool(reuse_port, true, "Whether to turn on the SO_REUSEPORT option");
Expand Down
1 change: 1 addition & 0 deletions src/graph/service/GraphFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DECLARE_int32(session_idle_timeout_secs);
DECLARE_int32(session_reclaim_interval_secs);
DECLARE_int32(num_netio_threads);
DECLARE_int32(num_accept_threads);
DECLARE_uint32(num_max_connections);
DECLARE_int32(num_worker_threads);
DECLARE_int32(num_operator_threads);
DECLARE_bool(reuse_port);
Expand Down
1 change: 1 addition & 0 deletions src/graph/service/GraphServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ bool GraphServer::start() {
thriftServer_->setReusePort(FLAGS_reuse_port);
thriftServer_->setIdleTimeout(std::chrono::seconds(FLAGS_client_idle_timeout_secs));
thriftServer_->setNumAcceptThreads(FLAGS_num_accept_threads);
thriftServer_->setMaxConnections(FLAGS_num_max_connections);
thriftServer_->setListenBacklog(FLAGS_listen_backlog);
if (FLAGS_enable_ssl || FLAGS_enable_graph_ssl) {
thriftServer_->setSSLConfig(nebula::sslContextConfig());
Expand Down
5 changes: 5 additions & 0 deletions src/storage/StorageServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ DECLARE_string(local_ip);
#endif
DEFINE_bool(storage_kv_mode, false, "True for kv mode");
DEFINE_int32(num_io_threads, 16, "Number of IO threads");
DEFINE_uint32(num_max_connections,
0,
"Max active connections for all networking threads. 0 means no limit. Max active "
"connections for each networking thread = num_max_connections / num_netio_threads");
DEFINE_int32(storage_http_thread_num, 3, "Number of storage daemon's http thread");
DEFINE_int32(check_memory_interval_in_secs, 1, "Memory check interval in seconds");

Expand Down Expand Up @@ -366,6 +370,7 @@ std::unique_ptr<apache::thrift::ThriftServer> StorageServer::getStorageServer()
server->setIdleTimeout(std::chrono::seconds(0));
server->setIOThreadPool(ioThreadPool_);
server->setThreadManager(workers_);
server->setMaxConnections(FLAGS_num_max_connections);
dutor marked this conversation as resolved.
Show resolved Hide resolved
if (FLAGS_enable_ssl) {
server->setSSLConfig(nebula::sslContextConfig());
}
Expand Down