On 19/08/11 02:59, Kaiwang Chen wrote:
> 在 2011年8月18日 下午9:07,Amos Jeffries<squid3_at_treenet.co.nz> 写道:
>> On 18/08/11 22:56, Chen Bangzhong wrote:
>>> Mean Object Size: 20.61 K
>>> maximum_object_size_in_memory 1024 KB
>>>
>>> So most objects will be save in RAM first, still can't explain why
>>> there are so many disk writes.
>>>
>>
>> Well, I would check the HTTP response headers there. Make sure they are
>> containing Content-Length: header. If that is missing Squid is forced to
>> assume it will have infinite length and require disk backing for the
>> object until it is finished arriving.
>
> Will squid require disk backing despite of the object size, even it is
> smaller than the receive buffer?
_require_ it. No. Do it that way due to old code, yes maybe.
The amount of data waiting to be processed does not matter much. Could
be zero bytes chunked encoded and a set of followup pipelined response
headers. Until it is processed and stored somewhere Squid can't tell if
its some bytes that happened to appear early, or the whole thing.
The packet size, read_ahead_gap, and the receive buffer size (dynamic!
1->64KB), and cache_dir min/max values all have an effect in that area.
I believe it picks a cache area before continuing to read more bytes
(but not completely certain).
If the cache_dir all have small maximum size limits and RAM looks bigger
it will go there. In fact cache_dir usage for backing being practically
welded in 3.1 series with large cache_mem have been showing signs of
memory-backing instead on occasion. The other dev have projects underway
to eliminate all that confusion in 3.2 anyways.
> Not sure what is the default size of receive buffer, is it one of these?
> read_ahead_gap 16 KB
sliding window of bytes to buffer unsent to the client. Mostly unrelated
to the receive buffer. When in effect its the minimum buffer size.
> tcp_recv_bufsize 0 bytes
The tcp_recv_bufsize is the maximum amount per read cycle (0 being use
the OS sysctl details, which is usually 4KB). Default buffer is
hard-coded as 1KB for most of 3.1 series. 4KB for older and newer
releases (slow-start algorithm from 1KB turned out to be bad for speed
on MB sized objects and no benefit for small ones).
Amos
-- Please be using Current Stable Squid 2.7.STABLE9 or 3.1.14 Beta testers wanted for 3.2.0.10Received on Thu Aug 18 2011 - 16:18:13 MDT
This archive was generated by hypermail 2.2.0 : Thu Aug 18 2011 - 12:00:04 MDT