Re: tune swap_level{1,2}_dirs for small site?

From: Yar Tikhiy <>
Date: Thu, 13 Nov 1997 19:19:20 +0300 (MSK)


Tilman Schmidt wrote:
> I am in the process of upgrading from version 1.0 to 1.1 (NOVM) with the
> new two-level subdirectory structure. My Squid is serving a rather small
> user community, and my cache typically contains less than 10,000 objects.
> Therefore the new structure in general, and the default setting of 16*256
> subdirectories in particular, seem like overkill to me. The rule-of-thumb
> formula in the docs gives me a value of L1*L2 = 40.
> Is there any negative impact from having two orders of magnitude too many
> subdirectories? Should I lower L1, L2, or both, or should I just keep the
> defaults and let Squid figure out for itself how to make sense of them?

AFAIK (IMHO? :-) the two-level cache structure was designed
in order to overcome the linear dependence of directory seek
time on the directory size. The problem arises because the Un*x
direcory is a linear list of entries, unlike modern filesystems
(e.g. NTFS or HPFS) that use some kind of hashing or balanced trees.
Therefore you must select the L1 and L2 values so that all of L1, L2
and the average number of objects per L2 directory are small numbers.

Let's count:

10,000/(16*16)=39 (approximately)
10,000/(16*32)=20 (approximately)

So, you may set L1 to 16 and L2 to 16 or 32.

SY, Yar
Received on Thu Nov 13 1997 - 08:27:58 MST

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