Re: cache_dir configuration option

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 19 Jan 1999 02:23:02 +0100

Oskar Pearson wrote:

> If you have a large number of files in a directory, the function
> that reads the directory to locate your file will be slow (it's a
> linear search).

True on most UNIX filesystems.

> The whole purpose of the multiple-directories is to make sure that each
> directory has a small number of files... how many files per directory you
> have depends on your OS, I guess.

Yes. A estimate is that directory files should be no larger than 8 to
16KB. Larger directories waste CPU time while smaller directories waste
memory.

The amount of L1 directories does not really matter much (as long as it
is enought). Squid only uses as many L1 directories as it needs for the
estimated number of swap files, and as you said searching is linear so
having any number of directories after the last used one does not really
have a impact on performance. L2 also determines how many files that go
into each L2 directory so it affects both the size of each L2 directory
and the size of each L1 directory. L1 only affects the size of the top
level directory and in theory this parameter could be calculated on the
fly from cache_dir size and avg_object_size.

You should also know that any change to these numbers (certainly L2, but
also L1 if it gets to small) invalidates whole or parts of your current
cache.

---
Henrik Nordstrom
Spare time Squid hacker
Received on Mon Jan 18 1999 - 18:49:50 MST

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