On 19/08/11 03:58, Chen Bangzhong wrote:
Amos, I want to find out what is filling my disk at 2-3MB/s. If there
is no cache related information in the response header, will squid
write the response to the disk?
In squid wiki, I found the following sentences:
Responses with Cache-Control: Private are NOT cachable.
Responses with Cache-Control: No-Cache are NOT cachable.
Responses with Cache-Control: No-Store are NOT cachable.
Responses for requests with an Authorization header are cachable ONLY
if the reponse includes Cache-Control: Public.
The following HTTP status codes are cachable:
200 OK
203 Non-Authoritative Information
300 Multiple Choices
301 Moved Permanently
410 Gone
My question is: If there is no Cache-control related information, such
as the following header
Server nginx/0.8.54
Date Thu, 18 Aug 2011 15:56:29 GMT
Content-Type application/json; charset=UTF-8
Content-Length 1218
X-Cache MISS from zw12squid.my.com
X-Cache-Lookup MISS from zw12squid.my.com:80
Via 1.0 zw12squid.my.com (squid/3.1.12)
Connection keep-alive
will squid save it to disk?
No. It has a small Content-Length. Will store to RAM. But your RAM cache
is running at 100% full, so something old will be pushed out to disk and
this fills the empty gap.
Lack of Cache-Control and Expires: headers means on the nest request for
its URL your refresh_pattern rules will be tested against the URL and
whichever one matches will be used to determine whether its served or
revalidated.
The only thing that could feed that algorithm is Date: when produced
and current time, so Squid is unlikely to get it right of the two are
very similar or very different. Probably leading to a revalidation or
new request anyway.
Can you give me a detailed description about when will squid save the
object to disk?
When it can't be saved to RAM cache_mem area.
* cache_mem is full => least-popular object goes to disk.
* object bigger than maximum_object_size_in_memory => goes to disk
* object smaller than minimum_object_size_in_memory AND a cache_dir
can accept it => goes to disk
* object unknown length => goes to disk. Maybe RAM as well.
Those are the cases I know about. There may be others.
We know disk I/O happens far more often than it reasonably should in
Squid. The newer releases since 2.6 and 3.0 are being improved to avoid
it and increase traffic speeds, but progress is slow and irregular.
You were going to try the memory-only caching. I think that was a good
idea for your 88% RAM-hit vs 1% disk-hit ratios.
Amos
--
Please be using
Current Stable Squid 2.7.STABLE9 or 3.1.14
Beta testers wanted for 3.2.0.10