squid cache_dir performance

I m using squid in my ubuntu 9.10 server edition. I always try to look for the best configuration for my network. My server spec is Pentium III with 128 MB and 10 GB harddisk.

This is the part of the squid configuration in /etc/squid/squid.conf I use.

cache_mem 50 MB
cache_swap_low 60
cache_swap_high 70
cache_dir ufs /mnt/sda6/ 2960 10 256
access_log /var/log/squid/access.log squid

I divided the harddisk into 6 and 4 GB partition. The 4GB is special for the squid disk cache.
I always change the cache_mem and cache_dir size for maximum performance of my network.
Because I only have 128 MB in memory, I put 50 MB only for my squid and the rest for my server system.
Then limit the cache swap in 60 to 70%.
Finally the cache_dir, I use 2960 mean 2,9 GB of 3,7 GB (it should 4GB) or about 80% of the disk space I use for squid. I use 80% from the squid manual setting.
Then using this formula from a friend ((( x / y ) / 256 ) / 256 ) * 2 = L1
x is the size of the partition, in KB unit.
y is the size of object that 13KB average
L1 is the option in cache_dir means how many directory exist in the partition
L2 is the option in cache_dir means how many folder inside the L1 folder. Usually 256
So my calculation is this ((( 2960000 KB / 13 KB) / 256 ) / 256 ) * 2 = 6.9

Then the cache dir will be

cache_dir 2960 7 256

I still watch the performance of this setting. I don’t know is it still the best setting for the growing network in my office or not. But we’ll see about that.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.