[squid-dev] SMP scaling in no_daemon mode?
Andreas Weigel
andreas.weigel at securepoint.de
Fri Jun 9 07:38:30 UTC 2017
Hi Alex,
thanks for the quick reply. I actually had stumbled across the mentioned
Bug and first thought, "hey, great, exactly my problem", but then was so
confused by the initial posts mixing up several issues at once that I
quit reading (and in addition had some misconceptions about SMP vs.
Multiple Instances of squid myself).
> AFAICT, that is what your patch correctly
> does inside watch_child(), among many other changes that look wrong or
> unfinished.
Shortly after posting, I noticed some problems with my patch (IamWorker,
IamMaster returning non-sense and in consequence, serverConnectionsOpen
not being called with only a single worker). I was able to patch that
behavior and have both setups running correctly now (both with -N,
forking children if workers > 1, else staying a single process). The
overall idea was to make the decision to create and manage kids to
depend on the number of configured workers/diskers. But I start to think
that this is not very wise because it prevents adding worker processes
by just reloading the configuration? Or am I mistaken and it actually is
possible? If it is, the -N and --foreground options would be somehow
redundant even after rephrasing.
In summary, the things should work like this IMO:
> * -N: The initial process is a master and a worker process.
> No kids.
> No daemonimization.
>
> * --foreground: The initial process is the master process.
> One or more worker kids (depending on workers=N).
> No daemonimization.
>
> * neither: The initial process double-forks the master process.
> One or more worker kids (depending on workers=N).
> Daemonimization.
>
I think I can agree to that. If my musings above are correct, -N should
probably also get a notice that it is not possible to add/remove workers
dynamically. And it should definitely not be termed "no daemon"-mode, as
that is what --foreground will probably do in the future.
What I get from http://bugs.squid-cache.org/show_bug.cgi?id=3826#c40 is,
that the mentioned setup works because systemd broadcasts
(KillMode=mixed) the signals to all child processes. AFAIK, other
supervision schemes like runit (which we are using), are capable of that
and TBH, I think it is a rather hacky workaround.
> Would you be willing to fix Squid to match the above summary?
Yes. I'll try. I fear that it won't be easy to make it correct for all
setups (e.g., the systemd stuff above). Also, the IamDaemon() function
should probably be renamed to UseMasterProcess (or similar). The
historically grown confusing mix of configuration options and command
line options that partially overlap each other add to the fun. I hope I
can cope ;-)
Kind Regards,
Andreas
--
Mit freundlichem Gruß / Best regards,
Andreas Weigel
UTM Backend Developer
Securepoint GmbH
Salzstrasse 1
D-21335 Lüneburg
https://www.securepoint.de
Tel.: +49(0)413124010
Fax: +49(0)4131240118
Geschäftsführer: Lutz Hausmann, Claudia Hausmann
Amtsgericht Lüneburg HRB 1776
USt.-ID-Nr.: DE 188 528 597
More information about the squid-dev
mailing list