Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed automatic threads_per_ioc logic. #872

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Fixed example broker's invalid sync connack call (#869)
* Added no CONNACK sending mode to the example broker (#869)
* Added posting code to acceptors (#867)
* Added io_context and threads setting options for example broker (#866, #871)
* Added io_context and threads setting options for example broker (#866, #871, #872)
* Fixed moved from object access (#865)
* <<<< breaking change >>>> Removed ioc_con() and ioc_accept() (#866)
* <<<< breaking change >>>> Unified automatic async/sync choosing flag. (#857, #862)
Expand Down
9 changes: 7 additions & 2 deletions example/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ verbose=1
certificate=server.crt.pem
private_key=server.key.pem

iocs=1
threads_per_ioc=1
# 0 means automatic
# Num of vCPU
iocs=0

# 0 means automatic
# min(4 or Num of vCPU)
threads_per_ioc=0

# Reload interval for the certificate and private key files (hours)
# When configured the broker will perform automatic loading of
Expand Down
2 changes: 1 addition & 1 deletion example/broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void run_broker(boost::program_options::variables_map const& vm) {
return 1;
} ();
if (threads_per_ioc == 0) {
threads_per_ioc = std::max(std::size_t(std::thread::hardware_concurrency()), std::size_t(4));
threads_per_ioc = std::min(std::size_t(std::thread::hardware_concurrency()), std::size_t(4));
MQTT_LOG("mqtt_broker", info) << "threads_per_ioc set to auto decide (0). Automatically set to " << threads_per_ioc;
}

Expand Down