// updating
$statelist = "";
+ $processes = 0;
foreach ($states AS $state => $usage) {
if ($statelist != "")
$statelist .= ", ";
$statelist .= $state.": ".$usage;
+ ++$processes;
}
- return($statelist);
+ return(array("list" => $statelist, "amount" => $processes));
}
}
?>
};
$processlist = dbm::processlist();
- if ($processlist != "")
- logger("Processlist: ".$processlist, LOGGER_DEBUG);
+ if ($processlist["list"] != "") {
+ logger("Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
+ if ($processlist["amount"] > 5)
+ return;
+ }
if (poller_max_connections_reached())
return;
// Log the type of database processes
$processlist = dbm::processlist();
- if ($processlist != "")
- logger("Processlist: ".$processlist, LOGGER_DEBUG);
+ if ($processlist["amount"] != "") {
+ logger("Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
+ if ($processlist["amount"] > 5)
+ return;
+ }
// Constantly check the number of available database connections to let the frontend be accessible at any time
if (poller_max_connections_reached())
load_config('system');
$processlist = dbm::processlist();
- if ($processlist != "")
- logger("Processlist: ".$processlist, LOGGER_DEBUG);
+ if ($processlist["list"] != "") {
+ logger("Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
+
+ // More than 20 running database processes?
+ // The system is too busy, so quit.
+ if ($processlist["amount"] > 20)
+ system_unavailable();
+ }
$maxsysload_frontend = intval(get_config('system','maxloadavg_frontend'));
if($maxsysload_frontend < 1)