# Re: [squid-users] cache_dir ... plz help

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 01 Nov 2001 22:37:48 +0100

This is how my poor tired head gets to 416

L1 = cache_dir_size * 2 * 1024 / (average_object_size * L2 * L2) =
cache_dir_size * 2 * 1024 / (13 * 256 * 256) =
cache_dir_size * 2 * 4 / (13 * 256) =
cache_dir_size * 4 / (13 * 128) =
cache_dir_size / (13 * 32) =
cache_dir_size / 416

Note: 2 * 1024 / 851968 = 1 / 416

Regards
Henrik

Scott Anderson wrote:
>
> please walk me through the math.
>
> Assuming a average_object_size of 13kb and a L2 value of 256. How do you
> get 416?
>
> 13 * 256 = 3328
> 3328 * 256 = 851968
>
> What is wrong with my math?
>
> Henrik Nordstrom wrote:
> >
> > Right. I must have been seriously sleep deprevated when I wrote the
> > message below.. but I wasn't that far off, only 2^2.
> >
> > The correct formula reads:
> >
> > L1 = cache_dir_size * 2 * 1024 / (average_object_size * L2 * L2)
> >
> > which when simplified equals to
> >
> > L1 = cache_dir_size / 416
> >
> > Regards
> > Henrik
> >
> > Scott Anderson wrote:
> > >
> > > That does not explain the number 416. If i take 2 * 13 * 256 * 256 this
> > > equals 1703936 which is a far cry from 416
> > >
> > > Henrik Nordstrom wrote:
> > > >
> > > > timo.dudziak@student.uni-siegen.de wrote:
> > > >
> > > > > cache_dir [ufs | asyncufs] dir MB L1 L2
> > > > > perfect for ext2:
> > > > > L2 := 256
> > > > > L1 := ceil( MB / 416 )
> > > > > so why / 416 ?
> > > >
> > > > Because someone simplified the calcuation for you by eleminating all
> > > > constants.
> > > >
> > > > L2 = 256 (there is generally no reason to change this on
> > > > ext2/ext3/ufs/whatever with a similar directory structure)
> > > >
> > > > L1 = ceil( MB * 1024 / (2 * average_object_size * L2 * L2))
> > > >
> > > > MB = size of the cache in MB
> > > > 2 = a safety margin
> > > > 1024 = conversion factor from MB to KB
> > > > average_object_size = 13 KB (farily standard)
> > > >
> > > > For reiserfs there MAY be a slight benefit in increasing L2 somewhat,
> > > > but not too much. There is only marginal differences in tuning this
> > > > parameter.
> > > >
> > > > Regards
> > > > Henrik Nordström
> > > > Squid Hacker
> > >
> > > --
> > > It is by caffeine alone I set my mind in motion,
> > > It is by the Beans of Java that thoughts acquire speed,
> > > The hands acquire shaking, the shaking becomes a warning,
> > > It is by caffeine alone I set my mind in motion.
> > >
> > > Scott Anderson
>
> --
> It is by caffeine alone I set my mind in motion,
> It is by the Beans of Java that thoughts acquire speed,
> The hands acquire shaking, the shaking becomes a warning,
> It is by caffeine alone I set my mind in motion.
>
> Scott Anderson
Received on Thu Nov 01 2001 - 14:45:34 MST

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