Skip to content

Commit

Permalink
fix: prohibit allocation of new Poco threads for incoming requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed Feb 17, 2025
1 parent 8a75f2a commit 7c2994f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/silo/api/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ int Api::runApi(const silo::config::RuntimeConfig& runtime_config) {
);
poco_parameter->setMaxThreads(runtime_config.api_options.parallel_threads);

// For better profiling, we do not want requests to allocate new threads in the thread pool.
// Instead, just allocate all of them directly on start-up (by setting minCapacity)
Poco::ThreadPool thread_pool(
/* minCapacity = */ runtime_config.api_options.parallel_threads,
/* maxCapacity = */ runtime_config.api_options.parallel_threads
);

Poco::Net::HTTPServer server(
new silo::api::SiloRequestHandlerFactory(database_mutex, runtime_config),
thread_pool,
server_socket,
poco_parameter
);
Expand Down

0 comments on commit 7c2994f

Please sign in to comment.