summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@gmail.com>2012-05-10 11:25:57 -0700
committerScott Ullrich <sullrich@gmail.com>2012-05-10 11:25:57 -0700
commitc9649cf848a723eb00b90ff3ce724d003912d3fc (patch)
treee9e6665df9bbe753fe2314c6ddbf0be671d8ef53
parent5b84bd652e68e682ee12a37857ac9bb4b4933b37 (diff)
parent98f20e357771e5a63bea9ea48da3a5c444193ad4 (diff)
downloadpfsense-c9649cf848a723eb00b90ff3ce724d003912d3fc.zip
pfsense-c9649cf848a723eb00b90ff3ce724d003912d3fc.tar.gz
Merge pull request #106 from irvingpop/master
max_procs adjustments for small memory systems, attempt 2
-rw-r--r--etc/inc/system.inc34
1 files changed, 19 insertions, 15 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 8ce0fa2..2847184 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -788,10 +788,9 @@ function system_webgui_start() {
}
/* generate lighttpd configuration */
- $max_procs = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 2;
system_generate_lighty_config("{$g['varetc_path']}/lighty-webConfigurator.conf",
$crt, $key, $ca, "lighty-webConfigurator.pid", $portarg, "/usr/local/www/",
- "cert.pem", "ca.pem", $max_procs);
+ "cert.pem", "ca.pem");
/* attempt to start lighthttpd */
$res = mwexec("/usr/local/sbin/lighttpd -f {$g['varetc_path']}/lighty-webConfigurator.conf");
@@ -821,7 +820,6 @@ function system_generate_lighty_config($filename,
$document_root = "/usr/local/www/",
$cert_location = "cert.pem",
$ca_location = "ca.pem",
- $max_procs = 1,
$max_requests = "2",
$fast_cgi_enable = true,
$captive_portal = false) {
@@ -866,27 +864,33 @@ function system_generate_lighty_config($filename,
$memory = get_memory();
$avail = $memory[0];
+ // Determine web GUI process settings and take into account low memory systems
if($avail > 0 and $avail < 65) {
$fast_cgi_enable = false;
}
+ if($avail > 64 and $avail < 256) {
+ $max_procs = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 1;
+ }
+ if($avail > 255 ) {
+ $max_procs = ($config['system']['webgui']['max_procs']) ? $config['system']['webgui']['max_procs'] : 2;
+ }
- // Ramp up captive portal max procs
- // Work relative to the default of 2, for values that would be >2.
+ // Ramp up captive portal max procs, assuming each PHP process can consume up to 64MB RAM
if($captive_portal == true) {
- if($avail > 65 and $avail < 98) {
- $max_procs = 1;
+ if($avail > 107 and $avail < 256) {
+ $max_procs += 1; // 2 worker processes
}
- if($avail > 97 and $avail < 128) {
- $max_procs = 2;
+ if($avail > 255 and $avail < 320) {
+ $max_procs += 1; // 3 worker processes
}
- if($avail > 127 and $avail < 256) {
- $max_procs += 1;
+ if($avail > 319 and $avail < 384) {
+ $max_procs += 2; // 4 worker processes
}
- if($avail > 255 and $avail < 384) {
- $max_procs += 2;
+ if($avail > 383 and $avail < 448) {
+ $max_procs += 3; // 5 worker processes
}
- if($avail > 383) {
- $max_procs += 3;
+ if($avail > 447) {
+ $max_procs += 4; // 6 worker processes
}
}
OpenPOWER on IntegriCloud