Softpurge and nearly immediate refresh?
Guillaume Quintard
guillaume at varnish-software.com
Wed Apr 11 09:37:23 UTC 2018
Hi,
That's indeed correct, a purge will kill all variations, and the restart
only fetches one.
The req.hash_always_miss trick however only kills/revalidate one variation.
At this moment, we have no way to purge/revalidate all the object under one
hash key.
--
Guillaume Quintard
On Wed, Apr 11, 2018 at 11:26 AM, Danila Vershinin <ciapnz at gmail.com> wrote:
> Hi Guillaume,
>
> A bit puzzled on something. If we use Vary: by some header.. am I correct
> that we need multiple restarts to refresh each object variation?
>
> Since the background fetch would only refresh the variation that matched
> initial purge request.
>
> Sent from my iPhone
>
> On 9 Apr 2018, at 12:18, Guillaume Quintard <guillaume at varnish-software.
> com> wrote:
>
> Hi,
>
> You can purge then set the method to GET then restart. Would that work for
> you?
>
> Other way is to use req.hash_always_miss that will only revalidate if we
> are able to fetch a new object.
>
> --
> Guillaume Quintard
>
> On Sat, Apr 7, 2018 at 12:10 PM, Danila Vershinin <ciapnz at gmail.com>
> wrote:
>
>> Hi,
>>
>> What I work with:
>>
>> * Grace mode configured to be 60 seconds when backend is healthy
>> * Using softpurge module to adjust TTL to 0 upon PURGE.
>>
>> The whole idea is increasing chances that visitors will get cached page
>> after cache was PURGEd for a page.
>>
>> Standard piece:
>>
>> sub vcl_hit {
>> if (obj.ttl >= 0s) {
>> # normal hit
>> return (deliver);
>> }
>>
>> if (std.healthy(req.backend_hint)) {
>> # Backend is healthy. Limit age to 60s.
>> if (obj.ttl + 60s > 0s) {
>> set req.http.grace = "normal(limited)";
>> return (deliver);
>> } else {
>> return(fetch);
>> }
>> } else {
>> # ...
>> }
>> }
>>
>> And use of softpurge:
>>
>> sub vcl_miss {
>> if (req.method == "PURGE") {
>> softpurge.softpurge();
>> return (synth(200, "Successful softpurge"));
>> }
>> }
>>
>> sub vcl_hit {
>> if (req.method == "PURGE") {
>> softpurge.softpurge();
>> return (synth(200, "Successful softpurge"));
>> }
>> }
>>
>>
>>
>> Current behaviour:
>>
>> * send PURGE for cached page
>> * Visitor goes to the page within 60 seconds and sees a stale cached page
>> (triggering background refresh)
>> * Further visits to the page will show refreshed page
>>
>> What I’m looking for:
>>
>> Trigger the background refresh right after PURGE while still leveraging
>> grace mode :) That is, serve stale cache for only as long as it takes to
>> actually generate the new page, and not wait for 60 seconds:
>>
>> * upon PURGE: set TTL to 0 (softpurge) + trigger background page request
>> (possible?)
>> * serve stale cache only while the page is generated
>>
>> I could have adjusted the “healthy backend grace period” to lower than
>> 60s, but I’m basically checking to see if it’s possible to refresh “nearly”
>> immediately in this kind of setup.
>>
>> Hope I made any sense :)
>>
>> Best Regards,
>> Danila
>>
>>
>> _______________________________________________
>> 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/20180411/e377e2e2/attachment.html>
More information about the varnish-misc
mailing list