Robert Wall wrote:

> Does anybody know offhand the exact method that Squid uses to store cached
> objects?

A hash based memory index is kept containing basic metadata on all the
objects, mapping URLs to disk files and/or memory cache.

On-disk cache directories are used in a circular fashion to maintain
some locality of related objects. 

If you have multiple cache_dir entries then Squid will spread the load
on the 2/3 least used cache_dir entries (recalculated approximately
every n_cache_dir*2/3 request).

Number of directories used in each cache_dir depends on the size of the
cache_dir. Squid uses 2*cache_dir_size/store_avg_object_size/L2 level 2
directories with L2 files in each to store the objects (or divided by L2
level 1 directories). The reason why twice as many directories is used
is to limit the amount of filesystem fragmenting by having each
directory fairly purged by the time it is reused.

--
Henrik Nordstrom
Spare time Squid hacker
  • Hello Robert Wall
    • Henrik Nordstrom

Reply via email to