Syed Jahanzaib – Personal 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 & you start to feel browsing is getting slower, and upon insecting squid cache log /var/log/squid/cache.log you see below error …

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

OR [depends on squid version you may need this]

max_filedescriptor

Save and exit editor.

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

service squid restart

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 . . .


Some Additional Tip!

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