On 14/02/2013 10:12 p.m., Amm wrote:
Hello, I have a query about how --with-filedescriptors and ulimit. Every 2-3 days I keep getting WARNING that system is running out of descriptors. I compiled squid using --with-filedescriptors=16384. So do I still need to set ulimit before starting squid?
Yes. Squid obeys both limits. The smaller of the two will determine how many are available for active use.
Or does squid automatically set ulimit? (as it starts as root)
Squid can set its available FD state at something higher. Squid built with system support for adjusting rlimit can use it to request higher limits. But ulimit (or SELinux and friends) can come along later and prevent a number of those sockets being opened...
I am using Fedora 16 with systemd squid.service (standard fedora file, no change) Cache.log says: 2013/02/14 10:28:52 kid1| With 16384 file descriptors available which is as expected. squidclient gives this: [root@localhost ]# squidclient -h 127.0.0.1 mgr:info |grep -i desc File descriptor usage for squid: Maximum number of file descriptors: 16384 Largest file desc currently in use: 888 Number of file desc currently in use: 774 Available number of file descriptors: 15610 Reserved number of file descriptors: 100 ulimit -H -n gives 4096 ulimit -n gives 1024 These are standard Fedora settings, I have not made any changes.
... when this proxy reaches the limit for Squid, you will get a message about socket errors and FD reserved will jump from 100 to something just below that limit to prevent running out of FD in future.
NP: there is a bug currently being investigated in squid-dev that Squid does not report when it does not have rlimit support available.
So back to my question: If I am compiling squid with --with-filedescriptors=16384 do I need to set ulimit before starting squid? Or does squid automatically set ulimit?
Yes. Amos