Re: script for checking average obj size?

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Fri, 17 Jan 1997 13:33:26 +0300 (EETDST)

> > Date: 16 Jan 1997 23:10:00 +0200
> > From: A.Reeh@andromeda.wad.org (Andreas Reeh)
>
> > does anybody have a script which checks the cache_dir and reports the true
> > average object size ?
>
> If you don't care about the headers counted in, i.e. you're only
> interrested in the average file size in your cache-dir may be this
> quick written perl script helps.
>
> #!/usr/local/bin/perl
>
> (($dir)=@ARGV)==1 || die "Usage: avgsize dir\n";
>
> open(FIND, "find $dir -type f -print |") || die "open() : $!, stopped";
> while(<FIND>)
> {
> chop;
> $sum += -s;
> $count++;
> }
> close(FIND);
> print "$count files with a total of $sum bytes\n";

    How about looking via cachemgr for current swapsize, then dividing that
 by count of StoreEntries? You'll get quite a real average object size...

    Or, if you like to be more sophisticated, isn't it more easy to parse
 squid's swap logfile instead of going through the whole directory structure?

    regards,

-------------------------------------------------------------------
 Andres Kroonmaa Telefon: 6308 909
 Network administrator
 E-mail: andre@ml.ee Phone: (+372) 6308 909
 Organization: MicroLink Online
 EE0001, Estonia, Tallinn, Sakala 19 Fax: (+372) 6308 901
-------------------------------------------------------------------
Received on Fri Jan 17 1997 - 03:51:58 MST

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