From 1a3323f2e6aa4ebe701f2e61a6829c8bedb7eb10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Weism=C3=BCller?= Date: Tue, 30 Oct 2018 12:06:59 +0100 Subject: [PATCH] BUG 11786 - squid: Remove setting for filter processes the number of Squid processes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I added a function to determine the number of cores. Now the number of squid processes will be equal to the number of logical cores. Further I removed the possibility of changing the number of squid processes in the proxy.cgi Signed-off-by: Daniel Weismüller Signed-off-by: root --- config/cfgroot/general-functions.pl | 7 +++++++ html/cgi-bin/proxy.cgi | 16 ++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 0577afe280..e8495e8854 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1165,5 +1165,12 @@ sub dnssec_status() { return $status; } +sub number_cpu_cores() { + open my $cpuinfo, "/proc/cpuinfo" or die "Can't open cpuinfo: $!\n"; + my $cores = scalar (map /^processor/, <$cpuinfo>); + close $cpuinfo; + + return $cores; +} 1; diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 738425b9ad..92bebfe188 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -287,7 +287,6 @@ $proxysettings{'IDENT_USER_ACL'} = 'positive'; $proxysettings{'ENABLE_FILTER'} = 'off'; $proxysettings{'ENABLE_UPDXLRATOR'} = 'off'; $proxysettings{'ENABLE_CLAMAV'} = 'off'; -$proxysettings{'CHILDREN'} = '10'; $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'}; @@ -436,11 +435,6 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} { $errormessage = $Lang::tr{'invalid maximum incoming size'}; goto ERROR; - } - if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1)) - { - $errormessage = $Lang::tr{'advproxy invalid num of children'}; - goto ERROR; } if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { @@ -1034,12 +1028,8 @@ print <
- - END ; -my $count = `ip n| wc -l`; -if ( $count < 1 ){$count = 1;} if ( -e "/usr/bin/squidclamav" ) { print ""; } else { print ""; } print ""; print ""; print < @@ -4095,7 +4083,7 @@ END if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on')) { print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n"; - print FILE "url_rewrite_children $proxysettings{'CHILDREN'}\n\n"; + print FILE "url_rewrite_children ", &General::number_cpu_cores(), "\n\n"; } # Include file with user defined settings. -- 2.39.2
$Lang::tr{'advproxy redirector children'}
$Lang::tr{'processes'}: *".$Lang::tr{'advproxy squidclamav'}."
"; if ( ! -e "/var/run/clamav/clamd.pid" ){ @@ -1048,18 +1038,16 @@ if ( -e "/usr/bin/squidclamav" ) { } else { print $Lang::tr{'advproxy enabled'}."
"; - print "+ ".int(( $count**(1/3)) * 8);} +} print "
".$Lang::tr{'advproxy url filter'}."
"; print $Lang::tr{'advproxy enabled'}."
"; -print "+ ".int(($count**(1/3)) * 6); print "
".$Lang::tr{'advproxy update accelerator'}."
"; print $Lang::tr{'advproxy enabled'}."
"; -print "+ ".int(($count**(1/3)) * 5); print "