Click to See Complete Forum and Search --> : Squid cache tuning


jymbo
04-23-2004, 01:21 PM
Can someone give me the formula for calculating cache_dir and cache_mem in relation to system specs?

For example: I have PII450/128MB RAM/40GB ATA66 that will run Squid for a small business LAN of 4 Win2k clients.

This is the most I've been able to find out from Google:

x=Size of cache dir in KB (i.e. 6GB=~6,000,000KB) y=Average object size
(just use 13KB z=Number of directories per first level directory

(((x / y) / 256) / 256) * 2 = # of directories

As an example, I use 6GB of each of my 13GB drives, so:

6,000,000 / 13 = 461538.5 / 256 = 1802.9 / 256 = 7 * 2 = 14

So my cache_dir line would look like this:

cache_dir 6000 14 256

So for my purposes, I would like to allocate 3GB of disk space for cache. When I run the figures through the formula, I get a cache_dir value of: 3000 7 256.

What I need to know is:

1.) How much RAM do I need to support this amount of disk cache? Is my 128MB enough? Is there a formula for determining the optimal cache_dir size based on a total system RAM? If 128MB is insufficient to support a 3GB cache, how do I adjust the cache_dir to accomodate?

2.) What should I set my cache_mem value to based on my system specs/cache_dir?

Thanks.

jymbo
04-23-2004, 02:12 PM
My bad...I forgot to look in the most obvious place of all: http://www.squid-cache.org

Here is what I've found on RAM requirements:
y = 10MB * xGB of disk cache + cache_mem + 20MB

Recommended system RAM = y * 2


I also read somewhere that the general rule of thumb for setting the cache_mem:

cache_mem = total physical memory / 3

So in my situation, my required system RAM would be 116MB (calculated with the default 8MB cache_mem).