Re: [squid-users] How Do I increase Cache Hits?

From: vda <[email protected]>
Date: Wed, 10 Mar 2004 09:09:47 +0200

On Wednesday 10 March 2004 01:57, marshall28@juno.com wrote:
> Does anyone know of a way to increase cache hits on your proxy? Is there a
> certain setting or configuration that will maximize cache hits and minimize
> the misses? What do you all recommend?

1. Kill ads. They won't eve hit, they typically use random names
   (45634563456363245982171859021.gif)
2. Cache images heavily. .gif's /.jpg's aren't typically change every 10 mins.
3. You may cheat and violate http a bit by converting reload into IMS.
   Only seriously broken sites will stop working 'properly'.
   Too bad for them.
4. You may cheat and violate http more by ignoring reloads for not so
   sensitive and rarely changing files (gif/jpegs again)

This is how I do it:

# Ban these
acl ads_regex url_regex -i [./]banners*[./?]
acl ads_regex url_regex -i [./]bannerserver[./?]
acl ads_regex url_regex -i [./]bannerbank[./?]
acl ads_regex url_regex -i [./]bannerfarm[./?]
acl ads_regex url_regex -i \.linkexchange\.ru:*[0123456789]*/
acl ads_regex url_regex -i [./]adv[./?]
acl ads_regex url_regex -i /count.*\?
acl ads_regex url_regex -i /ping.*\?
acl ads_regex url_regex -i [./]adserver
acl ads_regex url_regex -i /phpAdsNew.*/ad.*\.php\?
acl ads_regex url_regex -i /adsystem.*/ad.*\.php\?
acl ads_regex url_regex -i ^http://ar\.atwola\.com:*[0123456789]*/
acl ads_regex url_regex -i ^http://ads*[0123456789]*\.
acl ads_regex url_regex -i ^http://bs\.yandex\.ru:*[0123456789]*/count/
acl ads_regex url_regex -i ^http://c\.bigmir\.net:*[0123456789]*/\?
acl ads_regex url_regex -i ^http://counter\.rambler\.ru:*[0123456789]*/top100\.cnt\?
acl ads_regex url_regex -i ^http://images\.rambler\.ru:*[0123456789]*/upl/partners/.*gif
acl ads_regex url_regex -i ^http://images\.rambler\.ru:*[0123456789]*/upl/clients/.*gif
acl ads_regex url_regex -i ^http://top\.list\.ru:*[0123456789]*/counter\?
acl ads_regex url_regex -i ^http://u[0123456789\.]*\.spylog\.com:*[0123456789]*/cnt\?
acl ads_regex url_regex -i ^http://www\.ilk[0123456789]*\.com:*[0123456789]*/counter/count[0123456789]*\.php\?
acl ads_regex url_regex -i ^http://engine\.awaps\.net:*[0123456789]*/[0123456789/.]*gif.*
acl ads_regex url_regex -i ^http://bbn\.img\.com\.ua:*[0123456789]*/[0123456789/.]*\.gif
acl ads_regex url_regex -i ^http://web\.icq\.com:*[0123456789]*/client/ate/ad-handler/
acl ads_regex url_regex -i ^http://.*\.abn\.com\.ua:*[0123456789]*/iframe\?
acl ads_regex url_regex -i ^http://62.118.249.36:*[0123456789]*/images/[0123456789/]*\.gif
acl ads_regex url_regex -i ^http://www\.ad\.tomshardware\.com:*[0123456789]*/cgi-bin/bd\.m\?
acl ads_regex url_regex -i ^http://ad\.doubleclick\.net:*[0123456789]*/ad./
acl ads_regex url_regex -i ^http://pagead2\.googlesyndication\.com:*[0123456789]*/pagead/ads\?
acl ads_regex url_regex -i ^http://www\.yadro\.ru:*[0123456789]*/cgi-bin/show\?
acl ads_regex url_regex -i ^http://counter\.yadro\.ru:*[0123456789]*/hit\?
acl ads_regex url_regex -i ^http://servedby\.advertising\.com:*[0123456789]*/site
acl ads_regex url_regex -i ^http://z1\.adserver\.com:*[0123456789]*/
acl ads_regex url_regex -i ^http://tbs\.susanin\.com:*[0123456789]*/cgi-bin/tbs/banneri\.cgi\?
acl ads_regex url_regex -i ^http://pbnet\.ru/show:*[0123456789]*/show\.pl\?
acl ads_regex url_regex -i ^http://ad2\.pamedia\.com:*[0123456789]*\.au/js\.ng/site
acl ads_regex url_regex -i ^http://ad2\.pamedia\.com:*[0123456789]*\.au/html\.ng/site
acl ads_regex url_regex -i ^http://cdn\.valueclick\.com:*[0123456789]*/ad\.s/
acl ads_regex url_regex -i ^http://us\.a1\.yimg\.com:*[0123456789]*/us\.yimg\.com/a/in/information_usa/.*\.gif
acl ads_regex url_regex -i ^http://icqrus\.ru:*[0123456789]*/cgi/icq2k/all_bn\.cgi\?
acl ads_regex url_regex -i ^http://counter\.yadro\.ru:*[0123456789]*/logo\?
acl ads_regex url_regex -i ^http://cnt\.one\.ru:*[0123456789]*/cgi-bin/cnt\.cgi\?
acl ads_regex url_regex -i ^http://www2.aport.ru:*[0123456789]*/scripts/popup/popup.dll
acl ads_regex url_regex -i ^http://www\.linkexchange\.ru:*[0123456789]*/cgi-bin/rle\.cgi\?
acl ads_regex url_regex -i ^http://topshop-counter\.rambler\.ru:*[0123456789]*/top100\.cnt\?
acl ads_regex url_regex -i ^http://[0-9a-z.]*topcto\.ru:*[0123456789]*/cgi-bin/top\.cgi\?
acl ads_regex url_regex -i ^http://findme\.ru:*[0123456789]*/Counter/\?
acl ads_regex url_regex -i ^http://br\.gcl\.ru:*[0123456789]*/cgi-bin/br/br1055_4\.cgi\?
acl ads_regex url_regex -i ^http://195\.161\.118\.21/images/[0123456789/]*\.gif
acl ads_regex url_regex -i ^http://194\.125\.249\.67:*[0123456789]*/[0123456789/]*
acl ads_regex url_regex -i ^http://[0-9a-z.]*linkexchange\.ru:*[0123456789]*/cgi-bin/erle\.cgi\?
acl ads_regex url_regex -i ^http://sle-ent.com.ua:*[0123456789]*/\?
acl ads_regex url_regex -i ^http://sle-pvt.com.ua:*[0123456789]*/\?
acl ads_regex url_regex -i ^http://[0-9a-z.]*topping\.od\.ua:*[0123456789]*/cgi-bin/pinger\.cgi\?
acl ads_regex url_regex -i ^http://[0-9a-z.]*a-counter\.kiev\.ua:*[0123456789]*/a/
acl ads_regex url_regex -i ^http://im-tub\.yandex\.ru:*[0123456789]*/i\?
acl ads_regex url_regex -i ^http://t0\.extreme-dm:*[0123456789]*\.com/0\.gif\?
acl ads_regex url_regex -i ^http://www\.yandex\.ru:*[0123456789]*/cycounter\?
acl ads_regex url_regex -i ^http://www\.razom\.org\.ua:*[0123456789]*/ads/img/\?
acl ads_regex url_regex -i ^http://[0-9a-z.]*huyandex\.com:*[0123456789]*/c_banner\.php\?
acl ads_regex url_regex -i ^http://pagead2\.googlesyndication\.com:*[0123456789]*/pagead/show_ads\.js
acl ads_regex url_regex -i ^http://www\.clx\.ru:*[0123456789]*/rot\.php?
acl ads_regex url_regex -i ^http://oz\.valueclick\.com:*[0123456789]*/cycle\?
acl ads_regex url_regex -i ^http://w[0123456789]*\.hitbox\.com:*[0123456789]*/Hitbox\?
acl ads_regex url_regex -i ^http://b[0123456789]*\.abn\.com\.ua:*[0123456789]*/nsimg\?
acl ads_regex url_regex -i ^http://www\.burstnet\.com:*[0123456789]*/cgi-bin/ads/
acl ads_regex url_regex -i ^http://top\.list\.ru:*[0123456789]*/counter\?
...
http_access deny ads_regex
...
# refresh_pattern
# NB: refresh calcs fail horribly if your system time is not ok ;)
# min/max in in minutes
# regex min percent max [options]
#
# FTP
refresh_pattern ^ftp: 2880 50% 28800
# GOPHER
refresh_pattern ^gopher: 2880 0% 2880
# Images/video
refresh_pattern -i [.]jpg$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]jpeg$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]gif$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]png$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]swf$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]mp[g123]$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]mpeg$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]avi$ 2880 50% 2880000 override-lastmod reload-into-ims
# Data
refresh_pattern -i [.]gz$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]tgz$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]bz$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]bz2$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]zip$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]arj$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]rar$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]dat$ 2880 50% 2880000 override-lastmod reload-into-ims
# Probably generated content
refresh_pattern -i [.]php$ 0 20% 28800
refresh_pattern -i [?] 0 20% 28800
refresh_pattern -i cgi 0 20% 28800
# Probably plain HTML (first one is for http://host.com/dir/dir/ type URLs)
refresh_pattern -i /$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]htm$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]html$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]xml$ 2880 50% 2880000 override-lastmod reload-into-ims
refresh_pattern -i [.]css$ 2880 50% 2880000 override-lastmod ignore-reload
refresh_pattern -i [.]js$ 2880 50% 2880000 override-lastmod ignore-reload
# All other
refresh_pattern . 0 50% 28800

Questions? Comments?

--
vda
Received on Wed Mar 10 2004 - 00:12:17 MST

This archive was generated by hypermail pre-2.1.9 : Thu Apr 01 2004 - 12:00:02 MST