Syed Jahanzaib Personnel Blog to Share Knowledge !

March 22, 2012

Squid: Your cache is running out of filedescriptors Solution !

Filed under: Linux Related — Tags: , , — Syed Jahanzaib / Pinochio~:) @ 9:50 AM

If you have large number of proxy users , for example over 50 , and you start to feel browsing is getting slower, also you see the following error in /var/log/squid/cache.log

WARNING! Your cache is running out of filedescriptors

WARNING! Your cache is running out of filedescriptors

it means Squid proxy server is running out of file descriptors and cannot handle the extra requests sent by your client computers. therefore you need to increase descriptors value.

Use the following command to see the current descriptors value

squidclient -p 8080  mgr:info | grep ‘file descri’

Result As showed in the image below . . .

As you can see current file descriptors are 1024. To increase this value, edit your squid.conf file by

nano /etc/squid/squid.conf

now add this line

max_filedesc 4096

now save and exit.

Now restart your squid service to apply the changes you made by

service squid restart

Now again use following command to see the descriptors value

squidclient -p 8080  mgr:info | grep ‘file descri’

and this time you will notice that file descriptors have increased.
Result As showed in the image below . . .

 

==========================

Also do the following

nano /etc/sysctl.conf

Add following line in starting

fs.file-max = 65535

Save & Exit.
Now run following command to update

systcl -p

Regard’s
Syed Jahanzaib

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 2,049 other followers