[squid-dev] SMP scaling in no_daemon mode?

Andreas Weigel andreas.weigel at securepoint.de
Fri Jun 9 11:34:53 UTC 2017


Hi again,

just checked the --foreground option from the squid4 branch. Two things 
noticed:

- strg+c kills the main process that is waiting for its daemon to 
finish, but not the daemon (*ugh*)

     --> this is basically the unexpected --foreground behavior we 
already discussed and which should be fixed

- a SIGTERM  to the master process makes it wait for its children to 
shutdown for 30 seconds
     --> Is that desired behavior? I thought SIGTERM to be the more 
urgent or least equally urgent shutdown signal compared to SIGINT, which 
currently immediately triggers a shutdown. This would be easy to change 
in mainc.cc:shut_down but I guess that probably a lot of people would be 
upset. I do not know about other service supervisors, but runit uses a 
SIGTERM when shutting down or restarting a service, and, egoist I am, 
that's what I currently have to keep in mind (and waiting 30 seconds for 
an "sv restart", which sends a SIGTERM, is not so great)  ;-)  --- 
However, restarting can also be implemented manually, so that's not a 
major thing.

Apart from that, I'm actually quite happy with how easy it was (seemed 
to be) to make the desired changes to the squid4 branch (see attached 
patch):

workers 2
in squid.conf; output of ps fxao user,pid,ppid,pgid,sid,args | grep 
'squid.*-s$'


squid -s -N
stays in foreground
nobody   25756 20577 25756  2101          |       |   |           \_ 
./squid -N -s

squid -s
daemonized
root     25668  1700 25668 25668          \_ ./squid -s
nobody   25670 25668 25668 25668          |   \_ (squid-coord-3) -s
nobody   25671 25668 25668 25668          |   \_ (squid-2) -s
nobody   25672 25668 25668 25668          |   \_ (squid-1) -s


squid --foreground -s
not daemonized (stays in foreground)
root     25723 20577 25723  2101          |       |   |           \_ 
./squid --foreground -s
nobody   25725 25723 25723  2101          |       | |               \_ 
(squid-coord-3) --foreground -s
nobody   25726 25723 25723  2101          |       | |               \_ 
(squid-2) --foreground -s
nobody   25727 25723 25723  2101          |       | |               \_ 
(squid-1) --foreground -s

The PID-file in all cases refers to the master process, no matter if 
that means the master/worker combined (-N), the foreground master or the 
daemonized master. That makes me hope that existing setups relying on 
the PID-file (as in 
http://bugs.squid-cache.org/show_bug.cgi?id=3826#c40) should still be 
working.

I would greatly appreciate feedback to the proposed patch. I am also in 
the process of checking what has to be done for squid 5 and/or squid 3.5 
to get the behavior, although I think applying something similar to 3.5 
will require quite some backporting effort.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: squid4_fix_startup_foreground.patch
Type: text/x-patch
Size: 10390 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20170609/a5b04f95/attachment.bin>


More information about the squid-dev mailing list