Friday, January 27, 2012

pfSense and Squid Proxy - Managing RAM Usage

My systems RAM usage typically hovers between 60% and 80% and the installed system is pfSense 2.0.1 with Squid, SquidGuard, and LightSquid.


To manage your cache effectively and reduce memory usage:

On the Cache Management page: Reduce the Memory Cache Size parameter - I use around 25% of host system's installed RAM . This controls how many ``hot'' objects are kept in memory. Reducing this parameter will not significantly affect performance, but you may recieve some warnings in cache.log if your cache is busy.

Reduce the Hard Disk Cache Size on the Cache Management page (on a system with 4GB of RAM I use 10,000 MB, on an old 1GB I use 512 MB). This will reduce the number of objects Squid keeps. Your overall hit ratio may go down a little, but your cache will perform significantly better.

Reduce the Maximum Object Size parameter (I use 512 on new 4GB systems, 64 on an old 1GB). You won't be able to cache the larger objects, and your byte volume hit ratio may go down, but Squid will perform better overall. (The preceding uses information borrowed heavily from http://www.comfsm.fm/computing/squid/FAQ-8.html - all credit to the original author!)