mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Add Broker::max_live_threads and Broker::max_pcap_threads tunables
These may be used to change the number of scheduler threads that the underlying CAF library creates. In pcap mode, it's currently hardcoded to the minimal 4 threads due to potentially significant overhead in CAF.
This commit is contained in:
parent
6752ffcc8e
commit
c9fe9a943c
5 changed files with 55 additions and 17 deletions
|
@ -113,21 +113,18 @@ static inline Val* get_option(const char* option)
|
|||
return id->ID_Val();
|
||||
}
|
||||
|
||||
class configuration : public broker::configuration {
|
||||
public:
|
||||
configuration(broker::broker_options options)
|
||||
: broker::configuration(options)
|
||||
{
|
||||
openssl_cafile = get_option("Broker::ssl_cafile")->AsString()->CheckString();
|
||||
openssl_capath = get_option("Broker::ssl_capath")->AsString()->CheckString();
|
||||
openssl_certificate = get_option("Broker::ssl_certificate")->AsString()->CheckString();
|
||||
openssl_key = get_option("Broker::ssl_keyfile")->AsString()->CheckString();
|
||||
openssl_passphrase = get_option("Broker::ssl_passphrase")->AsString()->CheckString();
|
||||
}
|
||||
};
|
||||
Manager::BrokerConfig::BrokerConfig(broker::broker_options options)
|
||||
: broker::configuration(options)
|
||||
{
|
||||
openssl_cafile = get_option("Broker::ssl_cafile")->AsString()->CheckString();
|
||||
openssl_capath = get_option("Broker::ssl_capath")->AsString()->CheckString();
|
||||
openssl_certificate = get_option("Broker::ssl_certificate")->AsString()->CheckString();
|
||||
openssl_key = get_option("Broker::ssl_keyfile")->AsString()->CheckString();
|
||||
openssl_passphrase = get_option("Broker::ssl_passphrase")->AsString()->CheckString();
|
||||
}
|
||||
|
||||
Manager::BrokerState::BrokerState(broker::broker_options options)
|
||||
: endpoint(configuration(options)),
|
||||
Manager::BrokerState::BrokerState(BrokerConfig config)
|
||||
: endpoint(std::move(config)),
|
||||
subscriber(endpoint.make_subscriber({}, SUBSCRIBER_MAX_QSIZE)),
|
||||
status_subscriber(endpoint.make_status_subscriber(true))
|
||||
{
|
||||
|
@ -173,7 +170,22 @@ void Manager::InitPostScript()
|
|||
options.forward = get_option("Broker::forward_messages")->AsBool();
|
||||
options.use_real_time = ! reading_pcaps;
|
||||
|
||||
bstate = std::make_shared<BrokerState>(options);
|
||||
BrokerConfig config{std::move(options)};
|
||||
auto max_live_threads = get_option("Broker::max_live_threads")->AsCount();
|
||||
auto max_pcap_threads = get_option("Broker::max_pcap_threads")->AsCount();
|
||||
|
||||
if ( reading_pcaps )
|
||||
{
|
||||
if ( max_pcap_threads )
|
||||
config.scheduler_max_threads = max_pcap_threads;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( max_live_threads )
|
||||
config.scheduler_max_threads = max_live_threads;
|
||||
}
|
||||
|
||||
bstate = std::make_shared<BrokerState>(std::move(config));
|
||||
}
|
||||
|
||||
void Manager::Terminate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue