Re: [squid-users] How to improve Hit Ratio

From: Chris Robertson <crobertson_at_gci.net>
Date: Tue, 10 Feb 2009 15:03:14 -0900

Jevos, Peter wrote:
> Hi all
>
> I'd like to ask you how can I improve my Hit Ratio ( byte or request )
> cause it's on average 12-15 %, so it seems too low
>
> I'm using cacti to measure squid snmp activites and my basic config is:
>
> RAM: 1 GB
> cache_mem 8 MB
> maximum_object_size_in_memory 1 MB
> cache_dir ufs /var/cache/squid 5500 16 256
> minimum_object_size 0 bytes
> maximum_object_size 4194304 bytes
> cache_swap_low 90
> cache_swap_high 95
>
> refresh_pattern windowsupdate.com/.*\.(cab|exe) 4320 100% 43200
> reload-into-ims
> refresh_pattern download.microsoft.com/.*\.(cab|exe) 4320 100% 43200
> reload-into-ims
> refresh_pattern ^ftp: 1440 20% 10080
> refresh_pattern ^gopher: 1440 0% 1440
> refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 10080 90% 43200
> override-expire ignore-no-cache ignore-private
> refresh_pattern -i \.(iso|avi|wav|mp3|mp4|mpeg|swf|flv|x-flv)$ 43200 90%
> 432000 override-expire ignore-no-cache ignore-private
> refresh_pattern -i \.(deb|rpm|exe|zip|tar|tgz|ram|rar|bin|ppt|doc|tiff)$
> 10080 90% 43200 override-expire ignore-no-cache ignore-p
> rivate
> refresh_pattern -i \.index.(html|htm)$ 0 40% 10080
> refresh_pattern -i \.(html|htm|css|js)$ 1440 40% 40320
> refresh_pattern . 0 40% 40320
>
>
> I'm hosting about 30 clients.
> FQDNcache Entries: 362
> FQDNcache Requests: 25181
> FQDNcache Hits: 15192
> FQDNcache Negative Hits: 5348
> FQDNcache Misses: 4641
>
> IP Cache Statistics:
> IPcache Entries: 920
> IPcache Requests: 497622
> IPcache Hits: 332614
> IPcache Negative Hits: 1088
> IPcache Numeric Hits: 23602
> IPcache Misses: 140318
>
> Is it possible ot reach higher hit ratio ?
>

Without knowing your client's surfing habits, this is a hard question to
answer. I notice you have a refresh_pattern typical of Squid 2.5, which
means you probably also have lines like...

acl QUERY cgi-bin \?
cache deny QUERY

...which will deny caching anything that appears dynamic, even if the
headers indicate it's cacheable. Removing those, and adding...

refresh_pattern -i (/cgi-bin/|\?) 0 0% 0

...as your second-to-last refresh pattern might help. Using a log
analyzer like scalar.awk (http://scalar.risk.az/scalar095/) can go a
long way to showing what kind of objects are passing through your
cache. cachemgr's storedir output can give some useful information,
especially when using the default LRU replacement policy. Maybe you
need a larger cache. Perhaps your maximum_object_size is too small (or
too large). Or maybe your clients are just streaming music.

> Thanks
>
> pet
>

Chris
Received on Tue Feb 10 2009 - 23:59:21 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 11 2009 - 12:00:01 MST