Wednesday, July 30, 2014

Squid Stop Responding/Slow after some time - "WARNING! Your cache is running out of file descriptors"


Squid working fine for some time after restarting & then suddenly goes very slow. Even taking too much time to open google.co.in

Here are the steps need to check

[root@bhagwat ~]# tail -f /var/log/squid/cache.log

WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors


Please follow the below steps to fix the issue & improve the performance of squid

[root@bhagwat ~]# /etc/init.d/squid stop

##Open below file
v
i /etc/security/limits.conf

##Append following line to increase current limit from 1024 to 4096:

* - nofile 4096

[root@bhagwat ~]# vim /etc/squid/squid.conf

##Add the below line at last of squid.conf file

max_filedesc 8096

Save & quit squid.conf

Now open below file

[root@bhagwat ~]# vim /etc/init.d/squid

##Add this line before any code

ulimit -HSn 4096

save & quit the file

Start squid with below command

[root@bhagwat ~]# /etc/init.d/squid start

Enjoy..... Your issue is resolved.