Re: Optimal sizing of L1 and L2 directories

From: Henrik Nordstrom <>
Date: Fri, 02 Apr 1999 12:36:36 +0200

Zeus V. Panchenko wrote:

> According to the formula from the Release-Notes, i was wondering the results
> of my calculatings ... I have
> DS = 5G
> OS = 20K (recommended as i understood)
> NO = 256 (recommended as i understood)
> While trying to calculate L1 and L2 with the formula I got that L1*L2 it
> must be 67108864 dirs ... am i right when thinking that:
> L1*L2=DS/OS/NO is equal to L1*L2=(DS*NO)/OS or it must be (DS/OS)/NO?

No, the last one is the correct one. Also, recommended average object
size is 13.

Note that I do NOT agree with the size discussion in the release notes.
It was somewhat relevant once in a time, but not with the current
Squids. Also NO==L2 in that equation. The whole discussion is misguided.

My recommendation is not to fiddle with these, and use the defaults.
Only exception is perhaps on a very small cache where it may be helpful
to decrease the amount of L1 directories so that
L1=ceil(DS/(OS*L2*L2*2)) to avoid wasting some diskspace and inodes.

A guide if you'd like to fiddle with these are to first configure Squid
to use a small cache (100MB or something such) and let it run until it
has filled the cache a number of times (incoming traffic more than
4*cache size). Then check out the sizes of the used L2 directories. If
the sizes are larger than 8KB then you should perhaps decrease L2
somewhat. When you have found the optimal setting of L2 for your system
(median L2 directory file size slightly less than one memory page,
calculated only on the L2 directories that are used) then you can use
the expression above to find the optimal L1 setting to not waste disk on
unused directories.

Also remember that each change to L2 or each change to L1 which is less
than expressed above requires you to wipe your cache clean, so you do
not want to fiddle with these if your cache is filled.

directory file size is the size of the directory file, not the contents
in the directory.

Henrik Nordstrom
Spare time Squid hacker
Received on Fri Apr 02 1999 - 03:30:52 MST

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