[squid-users] filedescriptors on debian/systemd

Matus UHLAR - fantomas uhlar at fantomas.sk
Wed Aug 3 12:55:25 UTC 2022


On 03.08.22 08:17, ngtech1ltd at gmail.com wrote:
>I was under the impression that Systemd does impose a basic limit but I can test it to verify my doubts.
>From my point of view and testing until now systemd does impose a basic global limit.

this matches my observations - after logging into system, I see 1k soft and 
1M hard limit.

I have replaced squid binary with script that prints and replaces files 
limit and this is the result:

# cat /usr/sbin/squid
#!/bin/sh
ulimit -n -S > /tmp/limit.$$
ulimit -n -H >> /tmp/limit.$$
ulimit -n -S 2048
ulimit -n -S >>/tmp/limit.$$
ulimit -n -H >> /tmp/limit.$$
exec /usr/sbin/squid.real "$@"

# cat limit.1490
1024
524288
2048
524288

before:
2022/08/03 14:33:11 kid1| With 1024 file descriptors available

after:
2022/08/03 14:44:04 kid1| With 2048 file descriptors available


>-----Original Message-----
>From: squid-users <squid-users-bounces at lists.squid-cache.org> On Behalf Of Amos Jeffries
>Sent: Wednesday, 3 August 2022 5:31
>To: squid-users at lists.squid-cache.org
>Subject: Re: [squid-users] filedescriptors on debian/systemd
>
>On 3/08/22 01:54, Matus UHLAR - fantomas wrote:
>> I have encountered Debian bug 934208:
>>
>> 2022/07/28 16:40:53 kid1| With 1024 file descriptors available
>> 2022/07/29 06:50:18 kid1| WARNING! Your cache is running out of
>> filedescriptors
>>
>> according to the bug report:
>>
>> "Under systemd the default is not to have any limitation at all."

>To clarify, what that means is that *systemd* does not impose any limit
>by default.

as wee see above, it does.

> Squid when it cannot find a limit sets 1024 as default.

This may be the default if squid can't find a limit, but in this case the 
soft limit is set.

>Under systemd the "correct" way to set such a limit is for the admin to
>decide on a limit and configure it. You can do this is two ways:

I believe setting sane default (>1024) in squid itself or a systemd unit 
file is a better option.
Especially when sysvinit script sets such default.

>  1) set the systemd local config like you did:
>
>>
>> # cat /etc/systemd/system/squid.service.d/override.conf
>> [Service]
>> LimitNOFILE=65536
>>
>> and after reloading systemd:
>>
>> # systemctl daemon-reload
>>
>
>or, 2)
>
>   set max_filedescriptors in squid.conf


-- 
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Support bacteria - they're the only culture some people have.


More information about the squid-users mailing list