varnish storage tuning
Mike Perham
mperham at onespot.com
Mon Jun 15 17:27:59 CEST 2009
Just a follow up, I refactored my VCL to look like this:
sub vcl_recv {
if (req.request == "PURGE") {
lookup;
}
}
# Varnish's purge* routines are basically endorsed memory leaks.
# Don't ever use them.
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged";
}
}
sub vcl_miss {
if (req.request == "PURGE") {
error 200 "Purged (404)";
}
}
And now my Varnish servers have stabilized in terms of RSS and seem to
be running great. Thanks for the advice, Darryl!
On Thu, Jun 11, 2009 at 6:29 PM, Darryl Dixon - Winterhouse
Consulting<darryl.dixon at winterhouseconsulting.com> wrote:
> Hi Mike,
>
> Yes. If all you want to do is just get rid of the object, then all you
> need to do is set obj.ttl = 0 (as per your example below). In my case I
> wanted to honour the Cache-Control: no-cache header, which involved
> re-fetching the object from the backend. If you simply want to remove the
> item, then definitely you don't need to restart.
>
> regards,
> Darryl Dixon
> Winterhouse Consulting Ltd
> http://www.winterhouseconsulting.com
>
>> Does restart cause the backend to be queried for the page again? I'd
>> prefer
>> if a purge did not re-fetch the URL from the backend as this can caused
>> unwanted content to stay in the cache and my cache is relatively limited
>> in
>> size. Can I do something like:
>> sub vcl_hit {
>> if (req.request == "PURGE") {
>> set obj.ttl = 0;
>> error 200 "Purged";
>> }
>> }
>>
>> sub vcl_miss {
>> if (req.request == "PURGE") {
>> error 200 "Purged (not in cache)";
>> }
>> }
>>
>>
>> On Thu, Jun 11, 2009 at 4:46 PM, Darryl Dixon - Winterhouse Consulting <
>> darryl.dixon at winterhouseconsulting.com> wrote:
>>
>>>
>>> Instead, in vcl_hit, if the object should be purged, set obj.ttl to 0
>>> and
>>> then restart the request. This solved the problem for me.
>>>
>>>
>>
>
>
More information about the varnish-misc
mailing list