> This is the explanation on how calculate the swap_level1_dir and
> swap_level2_dir for squid.conf in the release note file.
>
> ( from the release note of squid 1.1.9)
>
> given:
> DS = amount of 'cache_swap' / number of 'cache_dir's
> OS = avg object size = 20k
> NO = objects per L2 directory = 256
>
> calculate:
> L1 = number of L1 directories
> L2 = number of L2 directories
>
> such that:
> L1 x L2 = DS / OS / NO
>
> Maybe (sure i'm not) i'm not a math guru', but it is'mt much clear
> Anyone can explain me in very-very clearly way ??
You probably don't want to change the defaults.
DS is the amount of space you have to use for each cache area. You
probably only have one area. If you have your cache on a 4G disk, then
DS will be around about that number. It corresponds to the value you
configure in squid.conf for swap_size.
If you have 4G (DS) in which to store objects, and each object on average
is 20k (OS), then you will be able to store about 200,000 objects (DS/OS).
Now at one extreme you could have 1 L1 directory and 1 L2 directory. The
single L2 directory would contain 200,000 objects when your cache was
full. Unix filesystems don't work optimally when there are that many
directory entries in a single directory.
256 entries in a single directory is a reasonable number. It should
typically be small enough to keep the size of the directory smaller
a filesystem block.
Since we want to have no more than 256 entries in a directory, the
number of directories required for the 200,000 objects is
200,000/256 (DS/OS/NO) or 781 directories.
If we only have 1 L1 directory, then you would have 781 L2 directories, which
is more than the limit of 256 entries per directory that we would like to
attain.
L2 == 16 and L1 == 256 are values that work well for wide range of cache
sizes.
The exception is if you have multiple cache_dir directives in your
configuration, then perhaps you should consider reducing L1. e.g. say we
had our cache spread across 8 x 512MB disks (and we couldn't concatenate
them into a single logical filesystem) then we would have something like
cache_dir /cache1
cache_dir /cache2
cache_dir /cache3
cache_dir /cache4
cache_dir /cache5
cache_dir /cache6
cache_dir /cache7
cache_dir /cache8
in our squid.conf. In this configuration I would make L1 == 2 instead
of the default 16.
You probably don't want to change the defaults, except perhaps in this
last scenario.
- Mark.
Received on Tue Apr 01 1997 - 02:28:10 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:55 MST