From 938978b9367ea481fb6ea720e39daf85a41824e4 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 23 Jan 2010 14:44:26 -0500 Subject: Make nbproc a tunable item on global settings tab --- config/haproxy/haproxy.inc | 6 +++++- config/haproxy/haproxy_global.php | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'config/haproxy') diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index 8e6984bf..5cf2c11f 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -115,7 +115,11 @@ function haproxy_configure() { fwrite ($fd, "\tlog\t\t\t{$a_global['remotesyslog']}\n"); fwrite ($fd, "\tuid\t\t\t80\n"); fwrite ($fd, "\tgid\t\t\t80\n"); - $numprocs = trim(`/sbin/sysctl kern.smp.cpus | cut -d" " -f2`); + // Set numprocs if defined or use system default (#cores) + if($a_global['nbproc']) + $numprocs = $a_global['nbproc']; + else + $numprocs = trim(`/sbin/sysctl kern.smp.cpus | cut -d" " -f2`); fwrite ($fd, "\tnbproc\t\t\t$numprocs\n"); fwrite ($fd, "\tchroot\t\t\t/var/empty\n"); fwrite ($fd, "\tdaemon\n"); diff --git a/config/haproxy/haproxy_global.php b/config/haproxy/haproxy_global.php index dc0949b4..290631ae 100755 --- a/config/haproxy/haproxy_global.php +++ b/config/haproxy/haproxy_global.php @@ -78,6 +78,7 @@ if ($_POST) { $config['installedpackages']['haproxy']['remotesyslog'] = $_POST['remotesyslog'] ? $_POST['remotesyslog'] : false; $config['installedpackages']['haproxy']['syncpassword'] = $_POST['syncpassword'] ? $_POST['syncpassword'] : false; $config['installedpackages']['haproxy']['advanced'] = base64_encode($_POST['advanced']) ? $_POST['advanced'] : false; + $config['installedpackages']['haproxy']['nbproc'] = $_POST['nbproc'] ? $_POST['nbproc'] : false; touch($d_haproxyconfdirty_path); write_config(); } @@ -94,6 +95,7 @@ $pconfig['synchost2'] = $config['installedpackages']['haproxy']['synchost2']; $pconfig['synchost3'] = $config['installedpackages']['haproxy']['synchost3']; $pconfig['remotesyslog'] = $config['installedpackages']['haproxy']['remotesyslog']; $pconfig['advanced'] = base64_decode($config['installedpackages']['haproxy']['advanced']); +$pconfig['nbproc'] = $config['installedpackages']['haproxy']['nbproc']; $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); if(strstr($pfSversion, "1.2")) @@ -198,6 +200,16 @@ function enable_change(enable_change) { + + + Number of processes to start. + + + +
+ Defaults to number of cores/processors installed if left blank. + + Remote syslog host -- cgit v1.2.3