Get rid of “WARNING! Your cache is running out of filedescriptors” in Squid Proxy
We have earlier discussed about installation & configuration of squid proxy server in our previous tutorials, PART 1 & PART 2 . In this tutorial, we are going to discuss about error ‘ WARNING! Your cache is running out of filedescriptors’. If you are running squid proxy server with cache than chances are that you have faced this issue where you get error ‘ WARNING! Your cache is running out of filedescriptors ‘ , even if you not faced this issue, you can follow this article to avoid similar issue in future.
Basically the error “WARNING! Your cache is running out of filedescriptors ” occurs when we have too many files opened or there are a number of error messages , than squid produces this error as squid is running out of file descriptors & could not handle the extra requests.
To resolve this issue we need to increase the value of file descriptors on our system, to do this we need to change values on three files. These files are,
limits.conf is the file to impose processes limitations & open file limits on whole system, we can impose soft & hard limits based on user. So to get rid of above mentioned squid error, we will increase the number of open files. Open the file,
$ sudo vim /etc/security/limits.conf
& add the following line,
* – nofile 65535
This will increase the number of open files to 65535 for all the users on the system.
Note:- To impose the new values of limits.conf, we might need to restart the system.
Next we need to increase the open file limit in /etc/sysconfig/squid file as well. So, open the file
$ sudo vim /etc/sysconfig/squid
& enter the following line in the file,
ulimit -n 65535
Save file & exit.
lastly we will enter the file descriptors value in main squid configuration file i.e. squid.conf,
$ sudo vim /etc/squid/squid.conf
& add the following line to the bottom of the file,
Save file & exit. Now we only have to restart the service to implement the changes that have been made.
$ sudo systemctl restart squid
Note:- If using RHEL or CentOS 5, use max_filedesc instead of max_filedescriptors . Also on RHEL/CentOS 5, we can enter max of 16384 filedescriptors while on RHEL/CentOS 6 & up , we can define file descriptors to max value of 2^20 i.e. 1048576.
We should now not be getting the error “WARNING! Your cache is running out of filedescriptors” is our cache logs for squid. With this we complete our tutorial, also read our other tutorials on Squid, links are mentioned below;
Leave your valuable feedback & comments in the comment box below.