Re: [squid-users] Memory usage...

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 23 Jul 2008 17:41:51 +1200

John Doe wrote:
> Hi,
>
> I saw this formula; is it correct?
> RAM needed ~= 10MB x <cache_dir GB> + <cache_mem> + 20MB
> recommanded ~= 2*RAM
>
> Exemple for 100GB of disk cache and 128MB of cache_mem:
> RAM ~= 10*100+128+20 ~= 1.148GB
> recommanded ~= 2*RAM ~= 2.296GB
>
> Exemple for 2GB of RAM and 128MB of cache_mem:
> disk cache ~= (2048-128-20)/10 ~= 190GB
> recommanded ~= disk cache / 2 ~= 95GB
>
> On what the 10MB x <cachedir GB> is based?
> An average object size?

Actual experienced measurements from some general-purpose web caches. On
32-bit systems. Newer 64-bit systems have reported a 15MB/GB requirement.

It's the amount of data seen to be used for index meta data and other
types of index.

Since the cache is usually the largest index, it's generally variant on
average object size (larger objects use less meta data bytes per object
byte).

>
> By example, we have objects with an average size of 10KB.
> 1 GB of cachedir would hold around 100.000 objects (not counting metadata, etc...).
> So 10MB of RAM for 100.000 objects = 100 bytes of RAM per object?

Sounds a bit small. The actual index entry per object is something in
the order of a few hundered bytes. There are also DNS, ACL, and
authentication caches, in-transit requests, etc to take care of as well.

The average average size of web traffic items here is around 64KB.

>
> But if we have 10MB objects, it would hold 100 objects.
> So 10MB of RAM for 100 objects = 100KB of RAM per object?
>
> And, basicaly, what is the max number of objects that can be cached in general, aside from memory/disk limits?

Assuming what sized object?

An (empty) web HTML 0.9 page has as few as 14 bytes. XML files likewise
may only have 20 bytes or so.
For a cache full of those (think dynamic web app gone downright evil),
you would need about 1MB memory per MB of cache.

Whereas at the other end, if you are caching only ISO DVD images. Your
memory drops to under 1KB memory per GB of cache.

Its a 'rule-of-thumb', which means we recommend to newbies that they use
it to plan and configure their system memory. And over time watch their
squid to see how it needs adjusting for best performance.

Amos

-- 
Please use Squid 2.7.STABLE3 or 3.0.STABLE8
Received on Wed Jul 23 2008 - 05:41:51 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 23 2008 - 12:00:05 MDT