Re: Optimal sizing of L1 and L2 directories

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 19 Mar 1999 23:03:07 +0100

Robert Wall wrote:

> I've noticed that Squid only appears to be using the first level directories
> 00 through 0A (I have them going up to 7F) on each of three drives.

Yes, that is normal, except that the default config only creates 1F (16)
first level directories.. The amount of directories actually used
depends on the size of the cache directory.

Squid uses a simple directory layout which is designed to works well for
both small and large setups.

> Is there a formula for calculating the optimal number of first and second
> level directories, as well as the number of objects per bucket, to ensure
> efficient utilization?

What you tune by adjusting the amount L1 and L2 directories is the
effectivenes of your OS directory cache and directory search times.
Using to few directories yelds higher CPU usage for directory searches,
to many increases the amount of memory needed for directory caches. The
ultimate goal is to have each directory file (the actual directory, not
the contents of it) sized at a size slightly less than a multiple of the
memory page size to minimize the amount of memory required, and not more
than a couple of pages in size to minimize the search time. The L0 and
L1 directories should be much smaller than L2 directories in the
interest of giving fast search times on average. Memory page sizes are
usually 4, 8 or 16KB depending on which CPU you use.

Hmm.. perhaps "squid -z" should be changed to not create more L1
directories than needed. That would lessen the sources to confusion
regarding cache directory use. But doing so requires changed syntax for
cache_dir, which I prefer not to.

---
Henrik Nordstrom
Spare time Squid hacker
Received on Fri Mar 19 1999 - 15:44:53 MST

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