Make the default for epoll_instances io_threads/2
This commit is contained in:
@@ -84,7 +84,16 @@ void ConfigParser::parse_server_config(const auto &toml_data,
|
|||||||
parse_field(srv, "unix_socket_path", config.unix_socket_path);
|
parse_field(srv, "unix_socket_path", config.unix_socket_path);
|
||||||
parse_field(srv, "max_request_size_bytes", config.max_request_size_bytes);
|
parse_field(srv, "max_request_size_bytes", config.max_request_size_bytes);
|
||||||
parse_field(srv, "io_threads", config.io_threads);
|
parse_field(srv, "io_threads", config.io_threads);
|
||||||
parse_field(srv, "epoll_instances", config.epoll_instances);
|
|
||||||
|
// Set epoll_instances default to io_threads/2 (min 1) if not explicitly
|
||||||
|
// configured
|
||||||
|
bool epoll_instances_specified = srv.contains("epoll_instances");
|
||||||
|
if (!epoll_instances_specified) {
|
||||||
|
config.epoll_instances = std::max(1, config.io_threads / 2);
|
||||||
|
} else {
|
||||||
|
parse_field(srv, "epoll_instances", config.epoll_instances);
|
||||||
|
}
|
||||||
|
|
||||||
parse_field(srv, "event_batch_size", config.event_batch_size);
|
parse_field(srv, "event_batch_size", config.event_batch_size);
|
||||||
parse_field(srv, "max_connections", config.max_connections);
|
parse_field(srv, "max_connections", config.max_connections);
|
||||||
parse_field(srv, "read_buffer_size", config.read_buffer_size);
|
parse_field(srv, "read_buffer_size", config.read_buffer_size);
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ struct ServerConfig {
|
|||||||
size_t max_request_size_bytes = 1024 * 1024;
|
size_t max_request_size_bytes = 1024 * 1024;
|
||||||
/// Number of I/O threads for handling connections and network events
|
/// Number of I/O threads for handling connections and network events
|
||||||
int io_threads = 1;
|
int io_threads = 1;
|
||||||
/// Number of epoll instances to reduce epoll_ctl contention (default: 2, max:
|
/// Number of epoll instances to reduce epoll_ctl contention (default:
|
||||||
/// io_threads)
|
/// io_threads/2, max: io_threads)
|
||||||
int epoll_instances = 2;
|
int epoll_instances = 2;
|
||||||
/// Event batch size for epoll processing
|
/// Event batch size for epoll processing
|
||||||
int event_batch_size = 32;
|
int event_batch_size = 32;
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ port = 8080
|
|||||||
# Maximum request size in bytes (for 413 Content Too Large responses)
|
# Maximum request size in bytes (for 413 Content Too Large responses)
|
||||||
max_request_size_bytes = 1048576 # 1MB
|
max_request_size_bytes = 1048576 # 1MB
|
||||||
# Number of I/O threads for handling connections and network events
|
# Number of I/O threads for handling connections and network events
|
||||||
io_threads = 6
|
io_threads = 12
|
||||||
# Event batch size for epoll processing
|
# Event batch size for epoll processing
|
||||||
event_batch_size = 32
|
event_batch_size = 32
|
||||||
epoll_instances = 2
|
|
||||||
|
|
||||||
[commit]
|
[commit]
|
||||||
# Minimum length for request_id to ensure sufficient entropy
|
# Minimum length for request_id to ensure sufficient entropy
|
||||||
|
|||||||
Reference in New Issue
Block a user