# squid not caching (much)

## plut0

I've had squid setup for a few months now.  I never really looked at the log files until recently.  I noticed that the I'm hardly ever getting any hits on this server.  I tested squid with another machine with a near default config file and I noticed quite a bit of hits.  So then I uploaded this config file to the original one and restarted squid.  Still missing a lot of hits.

My test is the same on both sides, same version (squid-2.6.12), same browser (firefox 2.0.0.3), browser cache disabled, same website (microsoft.com).  I kept refreshing the page and checking the log files and heres what I came up with:

broken machine:

```
1179371923.059     54  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/css/core.css - DIRECT/72.247.29.73 text/css

1179371923.105     45  TCP_MISS/304 348 GET http://i3.microsoft.com/shared/core/1/js/silverlight.js - DIRECT/72.247.29.88 application/x-javascript

1179371923.147     42  TCP_MISS/304 348 GET http://i3.microsoft.com/shared/core/1/js/callsilverlight.js - DIRECT/72.247.29.88 application/x-javascript

1179371923.186     39  TCP_MISS/304 349 GET http://i3.microsoft.com/shared/core/1/js/library.js - DIRECT/72.247.29.88 application/x-javascript

1179371923.242     55  TCP_MISS/304 347 GET http://i3.microsoft.com/Shared/core/1/bi/h/en/us/r/SiteRecruit_PageConfiguration_Homepage_Page.js - DIRECT/72.247.29.88 application/x-javascript

1179371923.292     49  TCP_MISS/304 334 GET http://i2.microsoft.com/shared/core/1/images/pageBG.jpg - DIRECT/72.247.29.73 image/jpeg

1179371923.409    592  TCP_MISS/200 37277 GET http://www.microsoft.com/en/us/default.aspx - DIRECT/207.46.19.190 text/html

1179371923.425     95  TCP_MISS/304 332 GET http://i.microsoft.com/shared/core/1/images/icon_search.gif - DIRECT/72.247.29.73 image/gif

1179371923.427     37  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/834d62a5-3d8f-4ee8-8b7f-f5f6dcf9728b.gif - DIRECT/72.247.29.73 image/gif

1179371923.430     39  TCP_MISS/304 333 GET http://i.microsoft.com/shared/core/1/images/ls.gif - DIRECT/72.247.29.73 image/gif

1179371923.451     41  TCP_MISS/304 333 GET http://i.microsoft.com/global/b55692a0-edbe-4ee3-9680-ada6692856fb.gif - DIRECT/72.247.29.73 image/gif

1179371923.460     35  TCP_MISS/304 333 GET http://i.microsoft.com/global/16ed10cf-f767-4f2c-ab12-f5e0686e0689.jpg - DIRECT/72.247.29.73 image/jpeg

1179371923.463     36  TCP_MISS/304 333 GET http://i.microsoft.com/global/8bf13019-de3c-4c76-a682-99d3ab75ec6e.gif - DIRECT/72.247.29.73 image/gif

1179371923.467     37  TCP_MISS/304 333 GET http://i.microsoft.com/global/719563fc-cf85-4670-9d11-73a62c781b9a.gif - DIRECT/72.247.29.73 image/gif

1179371923.486     35  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/dcb66f61-63c3-4b78-ab34-2adbd1211e61.png - DIRECT/72.247.29.73 image/png

1179371923.496     35  TCP_MISS/304 334 GET http://i.microsoft.com/global/1e3d809b-e091-4587-99d4-456bb4b2ab26.png - DIRECT/72.247.29.73 image/png

1179371923.498     35  TCP_MISS/304 334 GET http://i.microsoft.com/global/e9dd7b6a-e6cb-4a33-861f-d3dd9b6368ed.png - DIRECT/72.247.29.73 image/png

1179371923.502     35  TCP_REFRESH_HIT/304 331 GET http://i.microsoft.com/global/fa68983f-19cc-4b98-9c66-42e7547f0d08.png - DIRECT/72.247.29.73 image/png

1179371923.522     35  TCP_MISS/304 348 GET http://i3.microsoft.com/shared/core/1/js/webtrends.js - DIRECT/72.247.29.88 application/x-javascript

1179371923.543     46  TCP_MISS/304 334 GET http://i.microsoft.com/global/093eb841-5243-49a3-8b18-195fd1f1df1d.png - DIRECT/72.247.29.73 image/png

1179371923.544     41  TCP_REFRESH_HIT/304 331 GET http://i.microsoft.com/global/e793f2c6-45d7-4fb2-a9d7-f25ea60f5949.png - DIRECT/72.247.29.73 image/png

1179371923.545     46  TCP_MISS/304 334 GET http://i.microsoft.com/global/6f593f67-b367-4820-b5a1-e0ed025e8010.png - DIRECT/72.247.29.73 image/png

1179371923.557     35  TCP_MISS/304 331 GET http://i2.microsoft.com/shared/core/1/images/topbg.png - DIRECT/72.247.29.73 image/png

1179371923.579     36  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/searchboxbg.gif - DIRECT/72.247.29.88 image/gif

1179371923.582     37  TCP_MISS/304 331 GET http://i2.microsoft.com/shared/core/1/images/search_box.gif - DIRECT/72.247.29.88 image/gif

1179371923.584     38  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/activemenubg.png - DIRECT/72.247.29.73 image/png

1179371923.593     35  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/arrow_dw.png - DIRECT/72.247.29.73 image/png

1179371923.614     35  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/mainmenubg.gif - DIRECT/72.247.29.88 image/gif

1179371923.617     35  TCP_MISS/304 333 GET http://i2.microsoft.com/shared/core/1/images/mainmenuselected.jpg - DIRECT/72.247.29.88 image/jpeg

1179371923.620     36  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/bottombg.png - DIRECT/72.247.29.73 image/png

1179371923.628     35  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/featurePanelBG_3spot.png - DIRECT/72.247.29.73 image/png

1179371923.650     35  TCP_MISS/304 332 GET http://i2.microsoft.com/shared/core/1/images/newsbarBG.png - DIRECT/72.247.29.88 image/png

1179371923.653     35  TCP_MISS/304 331 GET http://i2.microsoft.com/shared/core/1/images/tabLabelBG.png - DIRECT/72.247.29.88 image/png

1179371923.748    119  TCP_MISS/200 974 GET http://m.webtrends.com/dcs4f6vsz99k7mayiw2jzupyr_1s2e/dcs.gif? - DIRECT/63.236.111.59 image/gif

1179371923.830    201  TCP_MISS/200 712 GET http://c.microsoft.com/trans_pixel.asp? - DIRECT/207.46.211.252 image/gif
```

working machine:

```
1179372428.588     60  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/css/core.css - DIRECT/64.111.215.160 text/css

1179372428.660     31  TCP_REFRESH_HIT/304 347 GET http://i3.microsoft.com/shared/core/1/js/silverlight.js - DIRECT/64.111.215.143 application/x-javascript

1179372428.727   1015  TCP_MISS/200 37277 GET http://www.microsoft.com/en/us/default.aspx - DIRECT/207.46.19.190 text/html

1179372428.741     80  TCP_REFRESH_HIT/304 347 GET http://i3.microsoft.com/shared/core/1/js/callsilverlight.js - DIRECT/64.111.215.143 application/x-javascript

1179372428.800     57  TCP_REFRESH_HIT/304 347 GET http://i3.microsoft.com/shared/core/1/js/library.js - DIRECT/64.111.215.143 application/x-javascript

1179372428.855     55  TCP_REFRESH_HIT/304 346 GET http://i3.microsoft.com/Shared/core/1/bi/h/en/us/r/SiteRecruit_PageConfiguration_Homepage_Page.js - DIRECT/64.111.215.143 application/x-javascript

1179372428.927     71  TCP_REFRESH_HIT/304 333 GET http://i2.microsoft.com/shared/core/1/images/pageBG.jpg - DIRECT/64.111.215.160 image/jpeg

1179372428.971     72  TCP_REFRESH_HIT/304 331 GET http://i.microsoft.com/shared/core/1/images/icon_search.gif - DIRECT/64.111.215.143 image/gif

1179372428.977     59  TCP_REFRESH_HIT/200 2684 GET http://i.microsoft.com/global/834d62a5-3d8f-4ee8-8b7f-f5f6dcf9728b.gif - DIRECT/64.111.215.143 image/gif

1179372428.979     66  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/shared/core/1/images/ls.gif - DIRECT/64.111.215.160 image/gif

1179372428.987     65  TCP_REFRESH_HIT/200 2658 GET http://i.microsoft.com/global/b55692a0-edbe-4ee3-9680-ada6692856fb.gif - DIRECT/64.111.215.160 image/gif

1179372428.995     70  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/16ed10cf-f767-4f2c-ab12-f5e0686e0689.jpg - DIRECT/64.111.215.143 image/jpeg

1179372428.999     70  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/8bf13019-de3c-4c76-a682-99d3ab75ec6e.gif - DIRECT/64.111.215.160 image/gif

1179372429.012     82  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/719563fc-cf85-4670-9d11-73a62c781b9a.gif - DIRECT/64.111.215.143 image/gif

1179372429.022     83  TCP_REFRESH_HIT/200 8587 GET http://i.microsoft.com/global/dcb66f61-63c3-4b78-ab34-2adbd1211e61.png - DIRECT/64.111.215.160 image/png

1179372429.037     58  TCP_REFRESH_HIT/304 330 GET http://i2.microsoft.com/shared/core/1/images/topbg.png - DIRECT/64.111.215.160 image/png

1179372429.040     69  TCP_REFRESH_HIT/304 331 GET http://i.microsoft.com/global/e793f2c6-45d7-4fb2-a9d7-f25ea60f5949.png - DIRECT/64.111.215.143 image/png

1179372429.057    103  TCP_REFRESH_HIT/304 333 GET http://i.microsoft.com/global/e9dd7b6a-e6cb-4a33-861f-d3dd9b6368ed.png - DIRECT/64.111.215.160 image/png

1179372429.077    114  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/093eb841-5243-49a3-8b18-195fd1f1df1d.png - DIRECT/64.111.215.160 image/png

1179372429.083    136  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/1e3d809b-e091-4587-99d4-456bb4b2ab26.png - DIRECT/64.111.215.143 image/png

1179372429.100    142  TCP_REFRESH_HIT/200 8172 GET http://i.microsoft.com/global/fa68983f-19cc-4b98-9c66-42e7547f0d08.png - DIRECT/64.111.215.143 image/png

1179372429.110    123  TCP_REFRESH_HIT/304 330 GET http://i2.microsoft.com/shared/core/1/images/search_box.gif - DIRECT/64.111.215.160 image/gif

1179372429.113    145  TCP_REFRESH_HIT/304 332 GET http://i.microsoft.com/global/6f593f67-b367-4820-b5a1-e0ed025e8010.png - DIRECT/64.111.215.143 image/png

1179372429.123    137  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/searchboxbg.gif - DIRECT/64.111.215.143 image/gif

1179372429.127    125  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/arrow_dw.png - DIRECT/64.111.215.160 image/png

1179372429.131    133  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/activemenubg.png - DIRECT/64.111.215.143 image/png

1179372429.137    124  TCP_REFRESH_HIT/304 332 GET http://i2.microsoft.com/shared/core/1/images/mainmenuselected.jpg - DIRECT/64.111.215.160 image/jpeg

1179372429.155    145  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/mainmenubg.gif - DIRECT/64.111.215.143 image/gif

1179372429.156    137  TCP_REFRESH_HIT/304 332 GET http://i2.microsoft.com/shared/core/1/images/featurePanelBG_3spot.png - DIRECT/64.111.215.160 image/png

1179372429.184    168  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/bottombg.png - DIRECT/64.111.215.143 image/png

1179372429.196    173  TCP_REFRESH_HIT/304 331 GET http://i2.microsoft.com/shared/core/1/images/newsbarBG.png - DIRECT/64.111.215.143 image/png

1179372429.200     43  TCP_REFRESH_HIT/304 330 GET http://i2.microsoft.com/shared/core/1/images/tabLabelBG.png - DIRECT/64.111.215.160 image/png

1179372429.205     67  TCP_REFRESH_HIT/304 347 GET http://i3.microsoft.com/shared/core/1/js/webtrends.js - DIRECT/64.111.215.143 application/x-javascript

1179372429.420     88  TCP_MISS/200 766 GET http://m.webtrends.com/dcs4f6vsz99k7mayiw2jzupyr_1s2e/dcs.gif? - DIRECT/63.236.111.59 image/gif

1179372429.513    179  TCP_MISS/200 688 GET http://c.microsoft.com/trans_pixel.asp? - DIRECT/207.46.211.252 image/gif
```

broken machine:

```
proxy squid # wc -l access.log

147917 access.log

proxy squid # grep HIT access.log | wc -l

2041
```

working machine:

```
proxy squid # wc -l access.log

1419 access.log

proxy squid # grep HIT access.log  | wc -l

594
```

1.37% vs. 41.86% cache rate, something is definitely wrong.  Its not just this website either, its all of them.  I tried blowing out the squid cache directory but it didn't help.  What is wrong with this machine?

----------

## ervin.peters

 *plut0 wrote:*   

> What is wrong with this machine?

 

Just guessing a bit: /etc/squid/squid.conf.

ervin

----------

## plut0

Here is the config I'm using on both machines for testing, works fine on one machine and on the other I get almost no hits:

```
http_port 3128

hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin \?

cache deny QUERY

acl apache rep_header Server ^Apache

broken_vary_encoding allow apache

cache_mem 128 MB

maximum_object_size 512 MB

minimum_object_size 0 KB

maximum_object_size_in_memory 512 KB

cache_replacement_policy heap LFUDA

memory_replacement_policy lru

cache_dir ufs /var/cache/squid 1000 16 256

access_log /var/log/squid/access.log squid

refresh_pattern ^ftp: 2880 100% 10080

refresh_pattern ^gopher: 2880 0% 1440

refresh_pattern -i [.]gif$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]jpg$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]jpeg$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]png$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]swf$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]mp[g123]$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]mpeg$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]avi$ 2880 100% 20160 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private ignore-auth

refresh_pattern -i [.]gz$ 2880 100% 20160

refresh_pattern -i [.]tgz$ 2880 100% 20160

refresh_pattern -i [.]bz$ 2880 100% 20160

refresh_pattern -i [.]bz2$ 2880 100% 20160

refresh_pattern -i [.]zip$ 2880 100% 20160

refresh_pattern -i [.]arj$ 2880 100% 20160

refresh_pattern -i [.]rar$ 2880 100% 20160

refresh_pattern -i [.]dat$ 2880 100% 20160

refresh_pattern -i [.]asp$ 0 20% 20160

refresh_pattern -i [.]php$ 0 20% 20160

refresh_pattern -i [?] 0 20% 20160

refresh_pattern -i cgi 0 20% 20160

refresh_pattern -i /$ 2880 100% 20160

refresh_pattern -i [.]htm$ 2880 100% 20160

refresh_pattern -i [.]html$ 2880 100% 20160

refresh_pattern -i [.]xml$ 2880 100% 20160

refresh_pattern -i [.]css$ 2880 100% 20160

refresh_pattern -i [.]js$ 2880 100% 20160

refresh_pattern . 0 100% 20160

acl all src 0.0.0.0/0.0.0.0

acl manager proto cache_object

acl localhost src 127.0.0.1/255.255.255.255

acl to_localhost dst 127.0.0.0/8

acl SSL_ports port 443

acl Safe_ports port 80          # http

acl Safe_ports port 21          # ftp

acl Safe_ports port 443         # https

acl Safe_ports port 70          # gopher

acl Safe_ports port 210         # wais

acl Safe_ports port 1025-65535  # unregistered ports

acl Safe_ports port 280         # http-mgmt

acl Safe_ports port 488         # gss-http

acl Safe_ports port 591         # filemaker

acl Safe_ports port 777         # multiling http

acl Safe_ports port 901         # SWAT

acl purge method PURGE

acl CONNECT method CONNECT

http_access allow manager localhost

http_access deny manager

http_access allow purge localhost

http_access deny purge

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

acl our_networks src 172.16.0.0/16

http_access allow our_networks

http_access allow localhost

http_access deny all

http_reply_access allow all

icp_access allow all

forwarded_for off

coredump_dir /var/cache/squid
```

----------

