RE: [squid-users] How do you clear the cache in Squid?

From: Lightfoot.Michael <Lightfoot.Michael@dont-contact.us>
Date: Mon, 11 Nov 2002 12:49:55 +1100

I'm not sure whether your original question (or the intent of that
question) has been completely answered,so here is a more detailed
discussion of cache directories and disk space.

Each cache_dir you specified relates to the maximum space occupied by
your cache files. Squid will keep track of what it thinks the space
occupied is. Unfortunately, this will not be the actual space occupied
in your cache filesystem.

Depending on the type of filesystem being used, the total number of
blocks used and available on the disk will be anything up to 20%
different than what you specify in cache_dir. The 20% bugger factor is
considered a reasonable figure for Berkeley type filesystems (UFS in
Solaris and similar Unixes, ext(2) in Linux, and the standard FS in BSD
variants.)

The reason for the difference is twofold. Firstly the swap.state file
occupies some space, although this is usually not significant wrt the
total filesystem size. Secondly, many cache files are less than the
block size of your filesystem (usually 8 KB) and are accomodated in
block fragments (usually 1-2 KB).

Block fragmentation is the cause of most of the problems with caches
filling up "too soon". What happens is that as files are added and
deleted, more blocks are partially occupied by small files, and the
number of free whole blocks decreases. Eventually this may cause the
filesystem to run out of free blocks altogether although it is nowhere
near full. The only solution to this problem is to either nuke your
cache periodically; reduce the cache_dir parameter until the problem is
successfully hidden; or periodically copy the filesystem to an archive
medium, nuke it, remake it and copy all the files back.

Each of the above workarounds has its own disadvantages/costs.

The case is different for extent-based filesystems (such as VxFS - the
Veritas filesystem). These will not suffer from block fragmentation but
may eventually fragment to the extent of reducing performance (too many
small extents causing files to have too many extents.)

My experience with Linux(Debian) and Solaris is that the best solution
is to spend the (large amount of) money getting a Veritas filesystem
licence (in the case of Solaris); or "wasting" 15-20% of your disk space
in the case of Linux and ext2.

> -----Original Message-----
> From: Francisco Obispo [mailto:fobispo@nic.ve]
> Sent: Saturday, 9 November 2002 7:24 AM
> To: Joe Cooper; squid-users@squid-cache.org
> Subject: Re: [squid-users] How do you clear the cache in Squid?
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi
>
>
> I have:
>
> cache_dir diskd /cache1 8000 16 256
> cache_dir diskd /cache2 8000 16 256
> cache_dir diskd /cache3 8000 16 256
> cache_dir diskd /cache4 8000 16 256
> cache_dir diskd /cache5 8000 16 256
> cache_dir diskd /cache6 8000 16 256
> cache_dir diskd /cache7 8000 16 256
>
> and
>
> cache_swap_low 90
> cache_swap_high 95
>
>
> but squid will fill up and use all the space available in about a
> month.. so, very often I have
> to delete all the cache_dir's ..
>
>
> Should I lower the watermarks?
>
>
>
>
> Joe Cooper wrote:
>
> | Sheahan, John (PCLN-NW) wrote:
> |
> |> I was thinking that restarting the services would do it but I
> remembered it
> |> is contained in a flat file. Do I need to delete the
> contents of that
> file?
> |
> |
> | I suspect you have more than one file. Most operating Squid caches
> have a couple hundred thousand cache files. ;-)
> |
> | Why do you need to clear your cache? Squid maintains it for you,
> under ordinary circumstances. If you must delete it, then

Michael Lightfoot
Unix Consultant
ISG Host Systems
Comcare
+61 2 62750680
Apologies for the rubbish that follows...
------------------------------------------------------------------------
NOTICE: This e-mail message and attachments may contain confidential
information. If you are not the intended recipient you should not use or
disclose any information in the message or attachments. If received in
error, please notify the sender by return email immediately. Comcare
does not waive any confidentiality or privilege.

Comcare's Canberra and Melbourne offices have moved to new premises.

We hope this notice makes it easier for you to update your records.
 
New street addresses:
 
Canberra office
Level 1
14 Moore street
CANBERRA CITY ACT 2601

Melbourne Office
Level 2
121 William Street
MELBOURNE VIC 3001
Claims Fax Number 03 9620 4721

Please call Comcare on 1300 366 979 if you have any queries.
Received on Sun Nov 10 2002 - 18:50:02 MST

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