diff --git a/conf/lms.conf b/conf/lms.conf index 1f883e1d..471bdaa2 100644 --- a/conf/lms.conf +++ b/conf/lms.conf @@ -31,6 +31,9 @@ approot = "/usr/share/lms/approot"; # Location for deployment (See README if you want to deploy on a non root path) deploy-path = "/"; +# Number of threads to be used to dispatch http requests (0 means auto detect) +http-server-thread-count = 0; + # Acoustic brainz's root API acousticbrainz-api-url = "https://acousticbrainz.org/api/v1/"; diff --git a/src/lms/main.cpp b/src/lms/main.cpp index b52ab3fb..917fc7f8 100644 --- a/src/lms/main.cpp +++ b/src/lms/main.cpp @@ -17,6 +17,8 @@ * along with LMS. If not, see . */ +#include + #include #include @@ -47,6 +49,7 @@ generateWtConfig(std::string execPath) const std::filesystem::path wtLogFilePath {Service::get()->getPath("log-file", "/var/log/lms.log")}; const std::filesystem::path wtAccessLogFilePath {Service::get()->getPath("access-log-file", "/var/log/lms.access.log")}; const std::filesystem::path wtResourcesPath {Service::get()->getPath("wt-resources", "/usr/share/Wt/resources")}; + const unsigned long configHttpServerThreadCount {Service::get()->getULong("http-server-thread-count", 0)}; args.push_back(execPath); args.push_back("--config=" + wtConfigPath.string()); @@ -81,6 +84,11 @@ generateWtConfig(std::string execPath) pt.put("server.application-settings.log-config", Service::get()->getString("log-config", "* -debug -info:WebRequest")); pt.put("server.application-settings.behind-reverse-proxy", Service::get()->getBool("behind-reverse-proxy", false)); + { + const unsigned long httpServerThreadCount {configHttpServerThreadCount ? configHttpServerThreadCount : std::max(1, std::thread::hardware_concurrency())}; + pt.put("server.application-settings.num-threads", httpServerThreadCount); + } + { boost::property_tree::ptree viewport; viewport.put(".name", "viewport");