[squid-users] Reverse Proxy: Why does one file get disk hit, but the other memory hit (consistently)?

From: Elli Albek <elli_at_sustainlane.com>
Date: Tue, 14 Jul 2009 00:41:58 -0700

Hi,
We have squid as reverse proxy that caches files. There are two types of
cacheable files. I see in the log that one type always gets TCP_HIT:NONE
(response from disk cache) and the other type always gets TCP_MEM_HIT:NONE
(response from memory cache).

What is the reason that one file type is not cached in memory, but still
cached on disk? If I ask this file a few times in a row it should be in
memory, but it is always on disk. If squid caches it with LRU, shouldn't it
be in the memory cache if it's the last file accessed?

Response headers for files that are cached always on DISK:

HTTP/1.x 200 OK
Expires: Tue, 14 Jul 2009 07:39:15 GMT
Cache-Control: max-age=600
Content-Type: text/xml;charset=UTF-8
Content-Length: 7963
Date: Tue, 14 Jul 2009 07:29:15 GMT
Age: 18
X-Cache: HIT from www.foo.com
Via: 1.1 www.foo.com (squid/2.7.STABLE6)
Connection: keep-alive

Headers for files that are cached always in MEMORY:

HTTP/1.x 200 OK
Etag: W/"7624-1237327990000"
Last-Modified: Tue, 17 Mar 2009 22:13:10 GMT
Content-Type: image/gif
Content-Length: 7624
Expires: Thu, 13 Aug 2009 05:10:48 GMT
Cache-Control: max-age=2592001
Date: Tue, 14 Jul 2009 07:08:58 GMT
Age: 187
X-Cache: HIT from www.foo.com
Via: 1.1 www.foo.com (squid/2.7.STABLE6)
Connection: keep-alive

This is consistent. One file is always on disk, the other always in memory.
No matter how many times I refresh.

Is there any http header that I can add to the first file to get it into
memory cache? Etag?

Relevant squid conf:
cache_dir aufs /usr/local/squid/var/cache 200 16 256

The rest is the default config file with reverse proxy configuration (should
be cache_replacement_policy lru). There is also an ACL that blocks certain
folders, this should not affect the LRU policy.

Thanks
Received on Tue Jul 14 2009 - 07:42:02 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 15 2009 - 12:00:03 MDT