Increase the maximum file descriptors for Squid
If Squid reports WARNING! Your cache is running out of filedescriptors in cache.log, your version of Squid was compiled with a maximum of 1024 file descriptors. This cannot be fixed directly with ulimit alone.
Supported Squid builds include the max_filedesc option to address this issue.
Supported Linux versions (so far, I only know about Red Hat)
Red Hat Enterprise Linux 3: squid-2.5.STABLE3-6.3E.18
Red Hat Enterprise Linux 4: squid-2.5.STABLE14-1.4E
Red Hat Enterprise Linux 5
Follow these steps to fix the problem.
- Edit /etc/security/limits.conf and add the following lines.
* - nofile 4096
- Log out and back in (you can press Ctrl-D) to load the changed configuration. Then type the following to check that the new value has been loaded.
# ulimit -a
open files (-n) 4096 3. Edit /etc/squid/squid.conf and add the following setting.
max_filedesc 4096
The value should be equal to the value set in /etc/security/limits.conf in step 1. 4. Restart the squid service:
# service squid restart
- Run squidclient with the following command to check that Squid has loaded the configuration.
# squidclient mgr:info
File descriptor usage for squid: Maximum number of file descriptors: 4096