Re: How to balance L1 and L2 caches?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 08 Dec 1999 04:04:33 +0100

Steve Snyder wrote:

> > L1 depends on the size of your cache, L2 and store_avg_object_size. For
> > Squid up to 2.2 L1 should be at least "cache_dir_size * 2 /
> > store_avg_object_size / L2 / L2". Less is bad, more will not hurt you
> > much.
>
> The calculation tells me:
>
> 512 * 1024 * 2 / 256 / 256 = 1.23

You forgot store_avg_object_size in your message. The result is correct.

> which, rounded up, is L1=2. So I only need L1=2 and L2=256
> to fully use my 512MB of cache space.

Yes.

> Would L1=4 and L2=128 be a better balance on my Linux (v2.2.13)
> system? I would think that the reduced number of L2 directories
> would make for reduced search times in comparison to L2=256.

Problem is it would also increase the amount of memory required to cache
the filesystem directory structure meta data. A smaller L2 value means
more L2 directories will be used by Squid since it then stores fewer
objects in each L2 directory.

For Linux EXT2 254 looks like a better choiche than 256. It makes a
directory size of 4KB, thereby possibly allowing a slightly better
utilization of the filesystem buffers.

EXT2 L2 directory sizes when fully populated by Squid objects:
1-62 1KB
63-126 2KB
127-190 3KB
191-254 4KB
[and so on with 1KB per 64 Squid cache files]

--
Henrik Nordstrom
Squid hacker
Received on Tue Dec 07 1999 - 20:35:41 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:49:46 MST