Re: [squid-users] squid performance tunning

From: Chen Bangzhong <bangzhong_at_gmail.com>
Date: Thu, 18 Aug 2011 18:56:47 +0800

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.

avg-cpu: %user %nice %system %iowait %steal %idle
           1.52 0.00 1.63 6.95 0.00 89.91

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz
avgqu-sz await svctm %util
sda 0.00 0.01 0.06 0.13 1.24 1.45 28.96
    0.00 4.16 2.20 0.04
sda1 0.00 0.01 0.06 0.11 1.24 1.45 31.69
    0.00 4.55 2.41 0.04
sdb 0.07 0.07 0.01 0.01 0.33 0.31 59.88
    0.00 19.77 15.75 0.03
sdc 0.00 2.08 9.16 104.96 81.61 1071.39
20.21 0.57 5.02 1.73 19.75

avg-cpu: %user %nice %system %iowait %steal %idle
           2.38 0.00 3.38 10.38 0.00 83.88

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz
avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdc 0.00 4.50 11.00 293.00 104.00 3768.50
25.48 7.26 23.88 1.92 58.30

avg-cpu: %user %nice %system %iowait %steal %idle
           3.25 0.00 2.63 3.88 0.00 90.24

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz
avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdc 0.00 0.50 15.50 94.50 150.00 644.25 14.44
    0.42 3.79 1.95 21.50

avg-cpu: %user %nice %system %iowait %steal %idle
           3.00 0.00 2.88 3.38 0.00 90.75

Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz
avgqu-sz await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    0.00 0.00 0.00 0.00
sdc 0.00 4.00 13.50 241.50 134.00 1609.75
13.68 0.89 3.37 0.76 19.50

在 2011年8月18日 下午6:50,Chen Bangzhong <bangzhong_at_gmail.com> 写道:
> thanks you Amos and Drunkard.
>
> My website hosts novels, That's, user can read novel there.
>
> The pages are not truely static contents, so I can only cache them for
> 10 minutes.
>
> My squids serve both non-cachable requests (works like nginx) and
> cachable-requests (10 min cache). So 60% cache miss is reasonable. It
> is not a good design, but we can't do more now.
>
> Another point is, only hot novels are read by users. Crawlers/robots
> will push many objects to cache. These objects are rarely read by user
> and will expire after 10 minutes.
>
> If the http response header indicates it is not cachable(eg:
> max-age=0), will squid save the response in RAM or disk? My guess is
> squid will discard the response.
>
> If the http response header indicates it is cachable(eg: max-age=600),
> squid will save it in the cache_mem. If the object is larger than
> maximum_object_size_in_memory, it will be written to disk.
>
> Can you tell me when will squid save the object to disk? When will
> squid delete the staled objects?
>
>
>
>
> 2011/8/18 Amos Jeffries <squid3_at_treenet.co.nz>:
>> On 18/08/11 19:40, Drunkard Zhang wrote:
>>>
>>> 2011/8/18 Chen Bangzhong:
>>>>
>>>> My cached objects will expire after 10 minutes.
>>>>
>>>> Cache-Control:max-age=600
>>>
>>> Static content like pictures should cache longer, like 1 day, 86400.
>>
>> Could also be a whole year. If you control the origin website, set caching
>> times as largeas reasonably possible for each object. With revalidate
>> settings relevant to its likely replacement needs. And always send a correct
>> ETag.
>>
>> With those details Squid and other caches will take care of reducing caching
>> times to suit the network and disk needs and updates/revalidation to suit
>> your needs. So please set it large.
>>
>>>
>>>> I don't know why there are so many disk writes and there are so many
>>>> objects on disk.
>>
>> All traffic goes through either RAM cache or if its bigger than
>> maximum_object_size_in_memory will go through disks.
>>
>> From that info report ~60% of your traffic bytes are MISS responses. A large
>> portion of that MISS traffic is likely not storable, so will be written to
>> cache then discarded immediately. Squid is overall mostly-write with its
>> disk behaviour.
>>
>> Likely your 10-minute age is affecting this in a big way. The cache will
>> have a lot of storable object which are stale. Next request they will be
>> fetched into memory, then replaced by a revalidation REFRESH (near-HIT)
>> response, which writes new data back to disk later.
>>
>>>>
>>>> In addtion, Disk hits as % of hit requests: 5min: 1.6%, 60min: 1.9%
>>>> is very low.
>>>
>>> Maybe cause by disk read timeout. You used too much disk space, you
>>> can shrink it a little by a little, until disk busy percentage reduced
>>> to 80% or lower.
>>
>> Your Squid version is one which will promote HIT objects from disk and
>> service repeat HITs from memory. Which reducing that disk-hit % a lot more
>> than earlier squid versions would show it as.
>>
>>>
>>>> Can I increase the cache_mem? or not use disk cache at all?
>>>
>>> I used all memory I can use :-)
>>
>> Indeed, the more the merrier. Unless it is swapping under high load. If that
>> happens Squid speed goes terrible almost immediately.
>>
>> 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 18 2011 - 10:56:54 MDT

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