Home > CentOS, Linux, RHEL, Squid > Squid WARNING! Your cache is running out of filedescriptors

Squid WARNING! Your cache is running out of filedescriptors

Note! This “fix” applies to RHEL / Red Hat / CentOS / Fedora.

Recently I noticed that our Squid was running a bit odd, getting stuck with CPU at 100%. After digging around in logs I found the following warning:

WARNING! Your cache is running out of filedescriptors

I found out that I just needed to rise the limit. There are multiple things that need doing.

First we will up the limit in the security/limits.conf file
Second we need to add the following line max_filedesc to squid.conf

Check the current limit:
squidclient -p 3128 mgr:info | grep ‘file descri’

Sample Output:
Maximum number of file descriptors:   1024
Available number of file descriptors:  338
Reserved number of file descriptors:   100

So the default limit is 1024 which is not a lot if you have over 50+ clients using the Squid.

Edit the following file :
vi /etc/security/limits.conf

and add the following limit:
* – nofile 4096

Log off from squid (close ssh session etc) and log back in.

Run the following command to see if the new limit is in place.

ulimit -a | grep ‘open files’

Sample Output:
open files                      (-n) 4096

Modify the Squid.conf and add the following line (somewhere to the bottom of the config)

max_filedesc 4096

Note! You can make it higher than 4096

Now restart the squid with the following command
service squid restart

Run the command from above again to verify that new limits are in place.


Categories: CentOS, Linux, RHEL, Squid Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: