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

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to