Our squid Web cache had a few hiccups today because we suddenly had a dramatic increase in connections, having to temporarily work around a failed Citrix Web interface.
Internet surfing crawled (pun intended) to an almost-stillstand as I noticed the dreaded:
WARNING: Your cache is running out of filedescriptors
The fix is quite easy, unless you have older Linux and/or squid versions.
For squid 2.5 and higher, the magic switches are two-fold:
- Increase the system's file-descriptor limits.
- Modify squid's configuration to accomodate the higher limits.
What I did was to edit squid's startup script (here:
add the line
ulimit -HSn 32768
just before squid is launched.
I then added the line
After restarting squid, I checked the
cache.log, and was glad to see:
Starting Squid Cache version 2.5.STABLE14 for x86_64-redhat-linux-gnu... Process ID 20567 With 32768 file descriptors available DNS Socket created ...
I'm happy, and our users are very happy. :-)