Re: [squid-users] squid performance tunning

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

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:50:32 MDT

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