From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer To: development@lists.ipfire.org Subject: Re: [PATCH] BUG 11786 - squid: Remove setting for filter processes the number of Squid processes Date: Tue, 30 Oct 2018 14:54:33 +0100 Message-ID: <91ca8d3f-9558-7931-2816-af520a8a5cd0@ipfire.org> In-Reply-To: <20181030110659.1517-1-daniel.weismueller@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3785258659013732006==" List-Id: --===============3785258659013732006== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, I tested this patch today and I fear the resulting value is too low. For me, its leads to: ***SNIP*** ... 2018/10/30 14:42:43 kid1| WARNING: All 2/2 redirector processes are busy. 2018/10/30 14:42:43 kid1| WARNING: 4 pending requests queued 2018/10/30 14:42:43 kid1| WARNING: Consider increasing the number of redirector processes in your config file. ... Current setting is "40" (Duo box, 2 Cores, 'squidclamav, squidguard) Best, Matthias On 30.10.2018 12:06, Daniel Weism=C3=BCller wrote: > I added a function to determine the number of cores. > Now the number of squid processes will be equal to the number of logical co= res. > Further I removed the possibility of changing the number > of squid processes in the proxy.cgi >=20 > Signed-off-by: Daniel Weism=C3=BCller > --- > config/cfgroot/general-functions.pl | 7 +++++++ > html/cgi-bin/proxy.cgi | 16 ++-------------- > 2 files changed, 9 insertions(+), 14 deletions(-) >=20 > diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-f= unctions.pl > index 0577afe28..e8495e885 100644 > --- a/config/cfgroot/general-functions.pl > +++ b/config/cfgroot/general-functions.pl > @@ -1165,5 +1165,12 @@ sub dnssec_status() { > =20 > return $status; > } > +sub number_cpu_cores() { > + open my $cpuinfo, "/proc/cpuinfo" or die "Can't open cpuinfo: $!\n"; > + my $cores =3D scalar (map /^processor/, <$cpuinfo>); > + close $cpuinfo; > + > + return $cores; > +} > =20 > 1; > diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi > index 738425b9a..92bebfe18 100644 > --- a/html/cgi-bin/proxy.cgi > +++ b/html/cgi-bin/proxy.cgi > @@ -287,7 +287,6 @@ $proxysettings{'IDENT_USER_ACL'} =3D 'positive'; > $proxysettings{'ENABLE_FILTER'} =3D 'off'; > $proxysettings{'ENABLE_UPDXLRATOR'} =3D 'off'; > $proxysettings{'ENABLE_CLAMAV'} =3D 'off'; > -$proxysettings{'CHILDREN'} =3D '10'; > =20 > $ncsa_buttontext =3D $Lang::tr{'advproxy NCSA create user'}; > =20 > @@ -437,11 +436,6 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) ||= ($proxysettings{'ACTION'} > $errormessage =3D $Lang::tr{'invalid maximum incoming size'}; > goto ERROR; > } > - if (!($proxysettings{'CHILDREN'} =3D~ /^\d+$/) || ($proxysettings{'CHILD= REN'} < 1)) > - { > - $errormessage =3D $Lang::tr{'advproxy invalid num of children'}; > - goto ERROR; > - } > if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') > { > $browser_regexp =3D ''; > @@ -1034,12 +1028,8 @@ print < >
> > - > - > END > ; > -my $count =3D `ip n| wc -l`; > -if ( $count < 1 ){$count =3D 1;} > if ( -e "/usr/bin/squidclamav" ) { > print ""; > } else { > print ""; > } > print ""; > print ""; > print <
$Lang::tr{'advproxy redirector chi= ldren'}
$Lang::tr{'processes'}: 3D'*'".$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::t= r{'advproxy url filter'}."
"; > print $Lang::tr{'advproxy enabled'}."
"; > -print "+ ".int(($count**(1/3)) * 6); > print "
".$Lan= g::tr{'advproxy update accelerator'}."
"; > print $Lang::tr{'advproxy enabled'}."
"; > -print "+ ".int(($count**(1/3)) * 5); > 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"; > } > =20 > # Include file with user defined settings. >=20 --===============3785258659013732006==--