varnish serve old object during refresh

Jaap van Arragon j.vanarragon at lukkien.com
Wed Feb 8 08:20:00 CET 2012


Yes I¹m sure.

The cached images are responding a lot faster and when I look into
varnishlog I can see that it is being hit.

Is it even possible to server old objects while retrieving new ones or is
there always one visitor that is experiencing slow images?

Thanks for your reply


On 2/7/12 2:27 PM, "AD" <straightflush at gmail.com> wrote:

> The VCL looks right at first glance.  Are you sure the object is actually
> being cached in the first place?  You can confirm with something like this in
> your vcl_deliver
> 
> if (obj.hits > 0) {
>      set resp.http.X-Cache = "HIT";
>      } else {
>      set resp.http.X-Cache = "MISS";
>   }
> 
> On Tue, Feb 7, 2012 at 2:48 AM, Jaap van Arragon <j.vanarragon at lukkien.com>
> wrote:
>> Hello,
>> 
>> Sorry for ³kicking² my question but I really need help with this.
>> 
>> How can I configure varnish 3 so that it will serve cached objects to the
>> client while the new objects are being fetched from the backed?
>> 
>> Hope to hear something.
>> 
>> Thank you.
>> 
>> Regards,
>> Jaap van Arragon
>> 
>> 
>> 
>> On 1/30/12 3:23 PM, "Jaap van Arragon" <j.vanarragon at lukkien.com
>> <http://j.vanarragon@lukkien.com> > wrote:
>> 
>>> Hello,
>>> 
>>> How can I serve an old object during the fetch of an expired object or max
>>> out connection?
>>> 
>>> I¹ve configured the grace period in both the vcl_recv as the vcl_fetch.
>>> 
>>> I even tried to use the saint mode to give me back an ³old² cached object.
>>> 
>>> Can somebody give me help in this matter?
>>> 
>>> sub vcl_recv {
>>> 
>>>     # Purge through http
>>>     if (req.request == "PURGE") {
>>>         if (!client.ip ~ purge) {
>>>             error 405 "Not allowed.";
>>>         }
>>>         ban("req.url ~ " + req.url );
>>>         error 200 "Purged.";
>>>     }
>>> 
>>>     # Unset all cookies available
>>>     if (req.http.cookie) {
>>>         unset req.http.cookie;
>>>     }
>>> 
>>>      if (req.request != "GET" && req.request != "HEAD") {
>>>         /* We only deal with GET and HEAD by default */
>>>         return (pass);
>>>     }
>>> 
>>>     # Adding Grace period in case backend lags
>>>     set req.grace = 3d;
>>>     return (lookup);
>>> }
>>> ....
>>> sub vcl_fetch {
>>>     set beresp.grace = 4d;
>>>     set beresp.saintmode = 50s;
>>>     set beresp.ttl = 30s;
>>>     return (deliver);
>>> }
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> varnish-misc mailing list
>>> varnish-misc at varnish-cache.org <http://varnish-misc@varnish-cache.org>
>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>> 
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120208/b9886aa4/attachment-0001.html>


More information about the varnish-misc mailing list