I am running Squid 2.7 on Ubuntu 10.04 64bits. I had the problem of Squid running out of file descriptors, with the following error showing in /var/log/squid/cache.log:
WARNING! Your cache is running out of filedescriptors
I checked with:
squidclient mgr:info | grep 'file descri'
and it showed that I had only 1024 file descriptors available.
I changed /etc/security/limits.conf, adding this at the end:
* soft nofile 32768
* hard nofile 32768
proxy soft nofile 32768
proxy hard nofile 32768
Added this to /etc/squid/squid.conf:
max_filedescriptors 32768
Also changed /etc/default/squid:
SQUID_MAXFD=32768
Nothing was working out. In the end I edited /etc/init.d/squid to add "ulimit -n 32768":
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
ulimit -n 32768
<... snipped ...>
That worked! :)
I had to do all this under the stress of a live, production Squid server being incredibly slow, so I am sure that this is NOT the right way to do it.
But what is the right way to do it?