Mailing List Archive

Prefetching a page from backend after timeout/purge
Varnish looks very promissing--thank you guys for making it happen.

A small question: I've been playing around with VCL and would like
Varnish to prefetch a fresh page from the backend after a timeout. The
idea is to spare the end user from waiting for a slow backend the first
time a page gets fetched after a timeout/purge.

Should'nt this ...

sub vcl_timeout {
fetch;
}

... do the trick? It doesn't seem to do what I expect.

The same issue when it comes to PURGE. I was hoping you could sneak a
"fetch" in here, but it doesn't work.

sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
fetch;
error 200 "Purged.";
}
}

Is there a way to let Varnish fetch a fresh page immediately after a PURGE?


/Anton
Prefetching a page from backend after timeout/purge [ In reply to ]
In message <45257776.7060002 at giraffen.dk>, Anton Stonor writes:
>Varnish looks very promissing--thank you guys for making it happen.
>
>A small question: I've been playing around with VCL and would like
>Varnish to prefetch a fresh page from the backend after a timeout. The
>idea is to spare the end user from waiting for a slow backend the first
>time a page gets fetched after a timeout/purge.
>
>Should'nt this ...
>
>sub vcl_timeout {
> fetch;
>}
>
>... do the trick? It doesn't seem to do what I expect.

Yes, but it's not implemented yet.

>The same issue when it comes to PURGE. I was hoping you could sneak a
>"fetch" in here, but it doesn't work.

No, fetch is not a legal action in vcl_hit.

Maybe it should be, but it isn't right now.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Prefetching a page from backend after timeout/purge [ In reply to ]
Poul-Henning Kamp wrote:
>> Should'nt this ...
>>
>> sub vcl_timeout {
>> fetch;
>> }

> Yes, but it's not implemented yet.

OK, thanks. Looking forward to it.

/Anton