varnish won't keep site up

Per Buer perbu at
Fri Feb 13 08:31:21 CET 2015

Hi Tim,

On Fri, Feb 13, 2015 at 7:35 AM, Tim Dunphy <bluethundr at> wrote:

> Hi all,
>  I seem to be getting a pretty good cache / hit ratio on my current VCL
> config.
> Hitrate avg:     0.9077   0.9242   0.9242

Not bad. You should note that a high traffic site can typically get quite a
bit higher than this. 97% and up should be achievable unless your content
production is off the chart.

> However I notice that if I stop my web server and go to the site I'm
> working with, instead of seeing a cached copy of the site, I instead see a
> varnish guru meditation error.
> I thought that the key to getting the site cached in such a way that you
> could completely stop the webserver and still view the site via the cache
> had a lot to do with this following line:
>  if(req.http.cookie ~ "cc_loggedin" || req.http.cookie ~ "|"){
>         return(pass);
>      }

This line will just pass requests that have a cookie that matches
cc_loggedin or PHPSESSID (btw; it could be simplified into req.http.cookie
~ "cc_loggedin| PHPSESSID". Do that and shave one microsecond of your
response time. :-). If a page isn't available in cache Varnish will turn to
backend and if the backend is down you'll get a guru meditation page.

Those users who have their requests passed will never encounter a cached
version so for them the site will be down the moment your backend is
offline. However, for 99% of the users the site can stay up. Look into
"grace mode" in the docs, it will show you how to enable this.

If you want further advice on what is happening you should have a look at
the logs from varnish when handling a particular request. Please note that
these logs might contain sensitive information such as sessions, ip
addresses and such.


*Per Buer*
CTO | Varnish Software AS
Cell: +47 95839117
We Make Websites Fly!
[image: Register now]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list