Re: [squid-users] some questions concerning cache_mem, L1, L2,...

From: Henrik Nordstrom <hno@dont-contact.us>
Date: 02 Feb 2003 13:23:33 +0100

sön 2003-02-02 klockan 10.29 skrev alp:
> Hi,
> I searched for some time the archives, but still I have some questions
> concerning the choice of
> cache_mem and L1, L2. maybe someone can help me understand:
>
> a) is this formula still correct: L1 = cache_size *2*1024 /
> (L2*L2*average_object_size)
> with a saftey margin of factor 2?
> in the L2 directories: will there always be a number of L2 files (as a
> maximum)?

Yes.

Yes, assuming L1 is sufficiently large.

> b) is it correct that L2 should be 254 instead of 256 on linux/ext2 systems?
> what about reiser fs?

Does not matter much. 256 is generally safe.

> c) is ist correct that for one object squid holds 72 Bytes (intel,sparc)
> data in memory for metadata?
> somewhere i read, squid uses only the hashlist of the md5 checksums in
> order to find the objects,
> somewhere else i read, squid uses the metadata + md5 checksum in memory.
> what is right?
> given 72 bytes - there is about 10 MB metadata memory used for 1 GB file
> cache. right?

The memory usage calculation documented in the FAQ holds quite well.

The exact size of a store entry varies a little from release to release,
but it is safe to say that it uses at least 72 bytes per object..

> d) in squid.conf, there is the default entry cache_dir ... 100 16 256
> but by the formula in a), given these values (100 mb and L2=256, 13 kb
> av_ob_si), L1 should be
> about only 1.
> why then these values are chosen as defaults?

Because it does not cost much to have too many L1 directories, and most
people should adjust the cache size to suit their setup.

> e) what about the value of cache_mem (default: 8mb)? since it is only used
> for hot, intransit, and
> negative-cached objects, what is the best value?

Somewhere around there is quite good for most setups. The best value is
depending on many factors like
 a) How much memory you have
 b) What type of workload you are having
 c) How big your cache are

and in certain situations some performance can be gained by increasing
cache_mem.

> given cache_size = 1gb and ram size = 1gb, what should be the value of
> cache_mem?

Not more than the remaining memory / 10 I would say.

> somewhere i read, that if cache_mem is too high, there might be swapping
> with negative effects for
> squid - why would this be so?

Because your machine then runs out of memory as it cannot fit both Squid
with it's cache_mem, object index and other data plus any other
applications you may have on the server in RAM.

> if i reserve 512 mb of 1gb ram for squid - then 10 mb would be for
> metadata, maybe another 20 mb for
> other squid needs. should i then use (512-10-20) mb for cache_mem in
> order to increase performance?

If you are happy with only 1GB cache then yes. But I would probably
spend a lot of that memory to allow for a larger cache instead.

> f) at last: the low and high watermarks - are they only used for file cache
> or also for the memory used
> for cache_mem?

Only for the cache.

> can i chooce any of the 4 cache replacement policies for file cache also
> for cache_mem?

Yes. See squid.conf.

-- 
Henrik Nordstrom <hno@squid-cache.org>
MARA Systems AB, Sweden
Received on Sun Feb 02 2003 - 05:23:47 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:13:12 MST