Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

varnish serve old object during refresh

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


j.vanarragon at lukkien

Jan 30, 2012, 6:23 AM

Post #1 of 6 (739 views)
Permalink
varnish serve old object during refresh

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);
}


j.vanarragon at lukkien

Feb 6, 2012, 11:48 PM

Post #2 of 6 (683 views)
Permalink
Re: varnish serve old object during refresh [In reply to]

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> 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
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


straightflush at gmail

Feb 7, 2012, 5:27 AM

Post #3 of 6 (664 views)
Permalink
Re: varnish serve old object during refresh [In reply to]

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>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> 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
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


j.vanarragon at lukkien

Feb 7, 2012, 11:20 PM

Post #4 of 6 (660 views)
Permalink
Re: varnish serve old object during refresh [In reply to]

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> 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>
> 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
>> <http://j.vanarragon [at] lukkien> > 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 <http://varnish-misc [at] varnish-cache>
>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc [at] varnish-cache
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>


perbu at varnish-software

Feb 8, 2012, 12:31 AM

Post #5 of 6 (666 views)
Permalink
Re: varnish serve old object during refresh [In reply to]

On Wed, Feb 8, 2012 at 8:20 AM, Jaap van Arragon
<j.vanarragon [at] lukkien>wrote:

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

There is always one poor sod.



--
Per Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
*Varnish makes websites fly!*
Whitepapers <http://www.varnish-software.com/whitepapers> |
Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
Twitter <https://twitter.com/varnishsoftware>


steve.webster at lovefilm

Feb 8, 2012, 1:59 AM

Post #6 of 6 (681 views)
Permalink
Re: varnish serve old object during refresh [In reply to]

On 8 Feb 2012, at 08:31, Per Buer wrote:

> On Wed, Feb 8, 2012 at 8:20 AM, Jaap van Arragon <j.vanarragon [at] lukkien> wrote:
>
> Is it even possible to server old objects while retrieving new ones or is there always one visitor that is experiencing slow images?
>
> There is always one poor sod.

This is unfortunate. Are there any plans to address this?

It would be nice to have grace mode be functionally equivalent to Squid's stale-while-revalidate, which will return stale content for all requests whilst kicking off an asynchronous revalidation request. It's easy to read about grace mode and assume it's doing the same thing, especially given the inevitable direct comparisons:

http://www.gossamer-threads.com/lists/varnish/dev/22475#22475

Cheers,

Steve

--
Steve Webster
Web Architect
LOVEFiLM

(Apologies for the overly long pointless footer that follows)

-----------------------------------------------------------------------------------------------------------------------------------------
LOVEFiLM UK Limited is a company registered in England and Wales.
Registered Number: 06528297.
Registered Office: No.9, 6 Portal Way, London W3 6RU, United Kingdom.

This e-mail is confidential to the ordinary user of the e-mail address to which it was addressed. If you have received it in error,
please delete it from your system and notify the sender immediately.

This email message has been delivered safely and archived online by Mimecast.
For more information please visit http://www.mimecast.co.uk
-----------------------------------------------------------------------------------------------------------------------------------------

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.