Re: [squid-users] only using one first-level cache directory

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 24 Mar 2003 23:05:34 +0100

I suppose you could write a small script which moves the files into
correct place.

Each filename is a hexadecimal number. The file belongs in

  L1 = number / L2 / L2
  L2 = (number / L2) % L2

  cache_dir/L1/L2/filenumber

With L2 = 256 the calculation becomes very easy. Each filename can then
be read

  XXL1L2XX

So I suppose the following script would work

#!/bin/sh
find [0-9]* -type f -print |
  sed -e 's%.*/.*/\(..\)\(..\)\(..\)\(..\)%\0 \2/\3/\1\2\3\4%' |
    while read line; do
      mv $line;
    done

Then clean up from the extra L2 directories by running

rm -rf ??/???

Regards
Henrik

Leon wrote:
>
> Ah ok then :) Thanks for your quick reply!
>
> Is there a way of moving to the suggested 16/256 structure from what I
> currently have without losing all the currently stored objects?
>
> Cheers, Leon
>
> ----- Original Message -----
> From: "Henrik Nordstrom" <hno@squid-cache.org>
> To: "Leon" <u0ld@dcs.shef.ac.uk>
> Cc: <squid-users@squid-cache.org>
> Sent: Monday, March 24, 2003 7:44 PM
> Subject: Re: [squid-users] only using one first-level cache directory
>
> Does look correct to me as you have told Squid to put up to 4194304
> (2048 * 2048) files in each L1 directory.. and as Squid starts with the
> first directory first all your files will be in the first L1 directory..
>
> With this setting all directories from 00/100 to 1F/7FF will not even
> have a theoretical chance of being used.
>
> Generally the default L2 parameter of 256 is recommended for all setups
> unless you have very specific reasons to change it (I usually use
> smaller values in testing with a very small cache, but 256 for larger
> caches >200MB). With a L2 parameter of 256 the default L1 parameter of
> 16 is good up to about 7GB of cache IIRC.
>
> Regards
> Henrik
>
> mån 2003-03-24 klockan 18.47 skrev Leon:
> > Hi there!
> >
> > I spotted something rather odd with my squid today. Using the config line
> >
> > cache_dir aufs /usr/local/squid/cache 2048 32 2048
> >
> > with squid-2.5.STABLE1-20030309, my cache directory looks like
Received on Mon Mar 24 2003 - 15:17:02 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:14:19 MST