[squid-users] Squid 3.5.20 rock store and enable-disk-io

Amos Jeffries squid3 at treenet.co.nz
Thu Sep 1 15:26:29 UTC 2016


On 2/09/2016 2:42 a.m., Alex Rousskov wrote:
> On 09/01/2016 01:48 AM, FredB wrote:
>>
>>>
>>> [Unit]
>>> Description=Squid Web Proxy Server
>>> After=network.target
>>>
>>> [Service]
>>> Type=simple
>>> ExecStart=/usr/sbin/squid -sYC -N
> 
> 
>> Yes this is the default value 
>>
>> http://bazaar.launchpad.net/~squid/squid/3.5/view/head:/tools/systemd/squid.service
>>
>> I guess this is wrong no ?
> 
> First of all, startup scripts is not my area of expertise. AFAICT, the
> correct short answer is "Using -N to start production Squid is usually
> wrong", but that is misleading because the _default_ systemd script may
> have to use -N until Squid itself provides a better alternative that is
> easy to use from the default systemd script.

Squid-3 and systemd do not play nicely together, especially in SMP mode.

Why?
 Both systemd and the initial 'squid' Squid-3 process are daemon manager
processes. Running a daemon manager to manage a daemon manager of a
different type results in some very weird 'broken' behaviours. (which
are logicaly consistent and should be expected when you look closely at
what the layers of managers are doing).

Also, systemd makes some (arguably brain-dead) assumptions about
processes it starts. Which are; that its only being used to start a
single-process binary (multi-thread is okay, multi-process like Squid
gets weird even when you take the manager part away), that the PID it
started is a daemon or can be run as one, that the .pid file can be
ignored. For kernel services that probably okay, for Squid-3 (and any
other daemon manager process like it) those assumptions are critically
wrong.

The result is that -N (forcing Squid to be a single daemon/worker
process) is the least problematic way to run Squid-3 under systemd,
Upstart, or OpenRC. It is still a bad way to run Squid, but the
most-working way with those daemon managers.

If you want Squid to run well with systemd you need Squid-4 with its
updated .service file (_dont_ use that .service file with Squid-3 it
will do more damage than good).


> 
> A better answer is probably something like "Do not use the default
> systemd script in production" and "Make sure you understand the command
> line options you pass to Squid".
> 
> Squid startup and daemon mode configuration is a complicated area that
> affects SMP, -z, and other features. There may be consensus among
> developers on what needs to be done there to improve/fix things, but
> nobody is working on that at the moment AFAICT.

AFAIK, most of what is needed has been done for Squid-4 and is too big a
change for Squid-3. The remaining bit is removing need for -z. Which is
optional anyhow and systemd can ignore.

Amos



More information about the squid-users mailing list