Fwd: Re: [squid-users] Squid Reverse Proxy (accel) always contacting the server

From: Daniele Segato <daniele.segato_at_gmail.com>
Date: Mon, 02 Apr 2012 08:37:08 +0200

(re-send, sent off-list as a mistake)

On 04/01/2012 03:21 AM, Amos Jeffries wrote:
> revalidation is more of a threshold which gets set on each object. Under
> the threshold no valdation takes place, above it every request gets
> validated. BUT ... a 304 response revalutating the object can change the
> threshold by sending new timestamp and caching headers.

Thank you I now managed to do exactly what I need...

I still have 2 little issues but I'll open another thread for those :)
you've been very helpful

> You have the two options of max-age or Expires. The thing to remember is
> to increment the value / threshold forward to the next poitn where you
> want revalidation to take place.
>
> with a max-age N value which you generate dynamically by: calculate
> current age of object when responding, add 60.
>
> with Expires: you simply emit a timestamp of now() + 60 seconds on each
> response.

yes I experimented.. I think 60 seconds is perfect for max-age and I get
rid of Expires time, it's overridden by the max-age anyway.

I also set up Vary and Last-Modified headers.
And added age (always 0) and Date (always "now") on my server response.

Squid3 is now caching perfectly my RESTfull service (GET)

> Other useful things to know;
> Generating an ETag label for each unique output helps caches detect
> unique versions without timestamp calculations. The easy ways to do this
> are to make ETag a MD5 hash of the body object. Or a hash of the
> Last-Modified timestamp string if the body is too expensive to locate
> MD5 for. Or some other property of the resource which is guaranteed to
> change any time the body changes and not otherwise.

Yeah, that's would be the next step, but it's a little complicated for
me to extract something that makes sense as an ETag, when I'll be able I
will

> Cache-Control:stale-while-revalidate tells caches to revalidate, but not
> to block the client response waiting for that validation to finish.
> Clients will get the old object until a new one or 304 is received back.

that's really interesting but I didn't find anything about it here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

is it standard?

thanks

do you, by any chance, know how to tell the cache to return a stale
value if the server is not responsive and while waiting it comes back
online?

this would be wonderful because it would allow me to take down the
server for maintenance without having a service interruption.

>> 2) which is the best way to debug why squid3 is deciding to keep a
>> cache entry, contact the server or not? looking at the huge debug log
>> is not very simple maybe some log option to filter it with the cache
>> decisions informations only would help
>
> debug_options 22,3
> ... or maybe 22,5 if there is not enough at level 3.

perfect!!!

where can I find a list of sections id and their meaning?
Received on Mon Apr 02 2012 - 06:32:57 MDT

This archive was generated by hypermail 2.2.0 : Mon Apr 02 2012 - 12:00:02 MDT