Question from Dec. 2009: "still using cache when fetching content"

John Norman john at
Fri Jan 8 22:20:46 CET 2010

Hi. I've just subscribed, and have been reading through the e-mail archives
for varnish-misc.

In Dec. 2009, Jean-Christophe Petit asked (with subject "still using cache
when fetching content"):

Is it possible to make Varnish sending the cache content at the same
time it is fetching from the backend ?
It will be more efficient for slow dynamic content ;)
For example, I have a php page taking up to 5sec to run. If Varnish was
able to get it while still sending the old cache page, it would be
really great.
No more unlucky visitor hitting it to update the cache..

There were a couple of replies, but I just wanted to flesh out the "use

I think the scenario would be:

(1) There is a page that takes a very long time to render (say, 90 seconds)
(2) It is cached, perhaps to expire after an hour
(3) In normal usage, everyone gets the cached page and is very happy
(4) An administrator would like to refresh that page in the cache BEFORE the
hour is up; but give any user the earlier cached page
(6) The admin would like a mechanism: "Please refresh now with this request,
but until the request is finished, serve whatever is in the cache."

This is different from grace, 'cos no one (except the admin) is incurring
the wait; and also the admin is asking for a refresh before the cached page
has expired.

Is this a feature that can be simulated in Varnish? Or a feature that might
be added at some time?

What we're concerned about is Google's timing of page download. If we set a
cache period to, say, an hour, and Google incurs the "first hit" after cache
expiry, then it (Google) has to wait for the finished page. In grace mode,
requests after the Google hit would get the earlier cached page; but, still,
Google has measured the page as taking, say, 60 seconds to download. In the
model above, Google would get the cached page; it would just be stale.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list