Allow multiple epoll instances on server
This commit is contained in:
@@ -84,9 +84,15 @@ void ConfigParser::parse_server_config(const auto &toml_data,
|
||||
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, "io_threads", config.io_threads);
|
||||
parse_field(srv, "epoll_instances", config.epoll_instances);
|
||||
parse_field(srv, "event_batch_size", config.event_batch_size);
|
||||
parse_field(srv, "max_connections", config.max_connections);
|
||||
parse_field(srv, "read_buffer_size", config.read_buffer_size);
|
||||
|
||||
// Clamp epoll_instances to not exceed io_threads
|
||||
if (config.epoll_instances > config.io_threads) {
|
||||
config.epoll_instances = config.io_threads;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -155,6 +161,16 @@ bool ConfigParser::validate_config(const Config &config) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (config.server.epoll_instances < 1 ||
|
||||
config.server.epoll_instances > config.server.io_threads) {
|
||||
std::cerr
|
||||
<< "Configuration error: server.epoll_instances must be between 1 "
|
||||
"and io_threads ("
|
||||
<< config.server.io_threads << "), got "
|
||||
<< config.server.epoll_instances << std::endl;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (config.server.event_batch_size < 1 ||
|
||||
config.server.event_batch_size > 10000) {
|
||||
std::cerr << "Configuration error: server.event_batch_size must be between "
|
||||
|
||||
Reference in New Issue
Block a user