Re: [squid-users] Squid 3.1.6, fails to cache static content

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 05 Aug 2011 03:47:28 +1200

On 05/08/11 03:24, J4K wrote:
> Hi there,
>
> Quick basic config question on a different server I have had to
> set-up. The server refuses to cache any items. Static test page
> (3751bytes) always give a cache MISS. I am unsure what I missed ;(
> Apologies for a such a simple configuration question.
>
> Squid Cache: Version 3.1.6
>
> http_port 11.11.11.11:3128
> auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid_passwd
> icp_port 0
> htcp_port 0
> snmp_port 0
> acl manager proto cache_object
> acl localhost src 127.0.0.1/32 ::1
> acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
> acl SSL_ports port 443
> acl SSL_ports port 8443
> acl Safe_ports port 80 # http
> acl Safe_ports port 3100 # http Tatsoft
> 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 488 # gss-http
> acl Safe_ports port 591 # filemaker
> acl Safe_ports port 777 # multiling http
> acl CONNECT method CONNECT
> acl ncsa_users proxy_auth REQUIRED
> acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
> acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
> acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
> acl localnet src fc00::/7 # RFC 4193 local private network range
> acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged)
> machines
>
> icp_access deny all
> htcp_access deny all
> snmp_access deny all
>
> http_access allow manager localhost
> http_access deny manager
> http_access deny !Safe_ports
> http_access deny CONNECT !SSL_ports
> http_access allow localhost
> http_access allow ncsa_users
> http_access deny localnet
> http_access deny all
> hierarchy_stoplist cgi-bin ?
> coredump_dir /var/spool/squid3
> refresh_pattern ^ftp: 1440 20% 10080
> refresh_pattern ^gopher: 1440 0% 1440
> refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
> refresh_pattern . 0 20% 4320
> cache_peer localhost parent 8118 0 default no-query no-digest
> no-netdb-exchange
> cache_dir aufs /var/cache/squid3 384 16 256
> maximum_object_size 512 KB
> never_direct allow all
>
>
> access.log:
> 1312470370.224 18 83.123.123.123 TCP_MISS/304 259 GET
> http://www.example.co.uk/ testuser DEFAULT_PARENT/localhost -
> 1312470373.292 5 83.123.123.123 TCP_MISS/304 259 GET
> http://www.example.co.uk/ testuser DEFAULT_PARENT/localhost -
> 1312470375.393 6 83.123.123.123 TCP_MISS/304 259 GET
> http://www.example.co.uk/ testuser DEFAULT_PARENT/localhost -
> 1312470377.442 5 83.123.123.123 TCP_MISS/304 259 GET
> http://www.example.co.uk/ testuser DEFAULT_PARENT/localhost -
> 1312470379.243 5 83.123.123.123 TCP_MISS/304 259 GET
> http://www.example.co.uk/ testuser DEFAULT_PARENT/localhost
>
> I presume that it is a problem with the cache_peer directive, but this
> should make sense to me if the proxy-only option was there, but its not.

No. 304 mesages do not have any object to be cached. Only 200, 4xx, or
5xx replies have object data to be stored. You can see the size of
transfer in those entries is never 3751 bytes, only 259 bytes happen
each time.

Also depends on the Cache-Control properties of both request and reply.

Clear your browser cache between tests or use a tool like squidclient,
wget, or curl to test with. Though be careful some tools force-refresh.
Glaring at (old?) curl versions there.

512KB seems a bit small of maximum object stored. Web 2.0 "pages" can be
huge and made from very large objects. Caching those extreme wasters is
where most of the speed gain from squid comes.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.14
   Beta testers wanted for 3.2.0.10
Received on Thu Aug 04 2011 - 15:47:34 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 04 2011 - 12:00:01 MDT