moz wrote:gstark wrote:In phpbb3 there's a server load parameter in the admin section, and it describes itself as being able to shut the board down if cpu load exceeds a defined value. It describes the value as a part of a CPU, but when I tried setting this to 0.45 - which I think should be allowed - it disabled the board as if it was being overloaded.
You sure it's not a percentage rather than a raw number? Just chequing...
That's a valid question. Here's the explanatory text from the setting in the admin panel ....
Limit system load:
If the system’s 1-minute load average exceeds this value the board will automatically go offline. A value of 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers and where this information is accessible. The value here resets itself to 0 if
phpBB was unable to get the load limit.
The documentation refers to a valid value as being between 0 and 1, all of which points to this not being a percentage.
Taking this to the next level, and looking at the admin tools on BH, I see a table, with lots of rows and data and green dots (meaning "good") and this is included amongst that data ...
Server Load 1.72 (4 cpus)
Which, if that's the sort of number that's being reported by BH to phpbb3, then it's not all that surprising that this doesn;t work all that well.
Looking more deeply, I've located a php script the guts of which are ...
- Code: Select all
$load = file_get_contents("/proc/loadavg");
$load = explode(' ', $load);
return $load[0];
My thoughts are to run a cron job with this code embedded, and set the board disable value based upon the value returned by this code snippet. I need to find what a good trip-value would be (10, 20, 50?), and I need to find what database values to change (it seems to be more than just the most obvious one in the config table, because my tests failed to disable the board.
) and then just run a cron job with, say, a frequency of once per minute.
In working through this I'm also trying to decide whether to update the database every time (not a lot of load, but mostly unnecessary transactions in the database - which might mean more load) or to just write and read a semaphore file, and only update the database when a state change is required. The former is easier, but I think the latter would be a better solution.