Commit 2c111cff authored by Sara Golemon's avatar Sara Golemon

Don't hardcode thread limit in ServerBootstrap

Summary: This was set to 32 which probably works fine for the
majority of FB servers, but not everyone's system is so endowed.

Closes #119

Reviewed By: @fredemmott

Differential Revision: D2187008
parent 5637418f
...@@ -120,8 +120,13 @@ class ServerBootstrap { ...@@ -120,8 +120,13 @@ class ServerBootstrap {
1, std::make_shared<wangle::NamedThreadFactory>("Acceptor Thread")); 1, std::make_shared<wangle::NamedThreadFactory>("Acceptor Thread"));
} }
if (!io_group) { if (!io_group) {
auto threads = std::thread::hardware_concurrency();
if (threads <= 0) {
// Reasonable mid-point for concurrency when actual value unknown
threads = 8;
}
io_group = std::make_shared<folly::wangle::IOThreadPoolExecutor>( io_group = std::make_shared<folly::wangle::IOThreadPoolExecutor>(
32, std::make_shared<wangle::NamedThreadFactory>("IO Thread")); threads, std::make_shared<wangle::NamedThreadFactory>("IO Thread"));
} }
// TODO better config checking // TODO better config checking
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment