Describe the bug
When opening the Business Process Dashboard, the code triggers an apply() call for every defined business process. Each call runs complex SQL SELECT queries against the IcingaDB instance.
With a larger number of business processes (or processes referencing many hosts/services), this results in a linearly increasing number of parallel connections to the IcingaDB database.
In our environment, this frequently causes us to hit the max_connections limit on the MariaDB instance.
Analysis
Excerpt from library/Businessprocess/Web/Component/Dashboard.php::
foreach ($processes as $name) {
if (Module::exists('icingadb') &&
(! $bp->hasBackendName() && IcingadbSupport::useIcingaDbAsBackend())
) {
IcingaDbState::apply($bp);
} else {
MonitoringState::apply($bp);
}
}
Inside IcingaDbState::apply(), yieldAll() is used to fetch service and host data from IcingaDB:
foreach ($this->backend->yieldAll($services->assembleSelect()) as $row) { ... }
foreach ($this->backend->yieldAll($hosts->assembleSelect()) as $row) { ... }
It appears that a new query (and connection) is opened for each configured process. Additionally, Redis lookups are performed for fresh state data but do not replace the database queries — they are executed in parallel.
Impact
- Parallel DB connections grow linearly with the number of processes.
- Short-lived spikes in
Threads_connected can cause performance degradation or even connection errors when max_connections is reached.
- Particularly problematic in distributed setups or when no connection pooling is in place.
To Reproduce
- Define multiple business processes (e.g., 50+).
- Open the Business Processes dashboard in IcingaWeb.
- Monitor the DB connections — the number of active connections spikes sharply.
Expected behavior
- Reuse existing DB connections (pooling) or process items sequentially to avoid spikes.
- Optionally allow configuration of a maximum parallelism threshold for queries.
Workarounds
- Increase
max_connections in MariaDB.
- Use a connection pooler like ProxySQL or MariaDB MaxScale.
- Reduce dashboard refreshes during high-traffic periods.
Screenshots
This is what I see when running SHOW FULL PROCESSLIST; at the right time:
Your Environment
Include as many relevant details about the environment you experienced the problem in
- Icinga Web 2 version and modules (System - About): 2.12.4
- Web browser used: Chrome
- Icinga 2 version used (
icinga2 --version): 2.14.5-1
- PHP version used (
php --version): 8.2.28
- Server operating system and version: RHEL9
Additional context
Add any other context about the problem here.
Describe the bug
When opening the Business Process Dashboard, the code triggers an
apply()call for every defined business process. Each call runs complex SQLSELECTqueries against the IcingaDB instance.With a larger number of business processes (or processes referencing many hosts/services), this results in a linearly increasing number of parallel connections to the IcingaDB database.
In our environment, this frequently causes us to hit the
max_connectionslimit on the MariaDB instance.Analysis
Excerpt from
library/Businessprocess/Web/Component/Dashboard.php::Inside
IcingaDbState::apply(),yieldAll()is used to fetch service and host data from IcingaDB:It appears that a new query (and connection) is opened for each configured process. Additionally, Redis lookups are performed for fresh state data but do not replace the database queries — they are executed in parallel.
Impact
Threads_connectedcan cause performance degradation or even connection errors whenmax_connectionsis reached.To Reproduce
Expected behavior
Workarounds
max_connectionsin MariaDB.Screenshots
This is what I see when running
SHOW FULL PROCESSLIST;at the right time:Your Environment
Include as many relevant details about the environment you experienced the problem in
icinga2 --version): 2.14.5-1php --version): 8.2.28Additional context
Add any other context about the problem here.