Search squid archive

Re: Reverse Proxy: Why does one file get disk hit, but the other memory hit (consistently)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Jul 2009 16:16:54 +0800, Drunkard <gongfan193@xxxxxxxxx> wrote:
> 在 2009-07-14二的 00:41 -0700,Elli Albek写道:
>> 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?

No, its in the cache as the last file accessed it jumps to the front of the
_index_.
The actual source location only changes when the object changes and needs
replacing.

You can use a PURGE request to drop it from cache, and the next request
will cache it to memory if there is space.  When things move to disk they
usually stay there. And everything gets flushed to disk for safe-keeping
storage when squid is restarted.


>> 
>> 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
> Maybe this help:
> 	maximum_object_size_in_memory 8192 KB
> 	maximum_object_size 1024000 KB
> 	store_avg_object_size 130 KB

I'm not sure about help. But they are the options to look at tuning to
permit/deny larger objects into memory.
Note that maximum_object_size_in_memory wont work unless smaller than the
more global maximum_object_size.

Amos


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux