Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Possible to cache a page for grace mode despite a TTL of 0?

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


victor.cheng at paperg

Jun 4, 2012, 5:17 PM

Post #1 of 2 (287 views)
Permalink
Possible to cache a page for grace mode despite a TTL of 0?

I'm not sure if this improper usage of Varnish or not, but I'd like to do
the following for high availability purposes:

I have a page that's dynamic in nature, but I want to be able to serve a
cached copy of it if the backend servers happen to go down.

Is it possible to do this while setting the beresp.ttl to 0? This seems to
prevent grace mode and works fine if I set it to 1 (as well as if I set the
relevant grace mode params), but showing people a cached page for even one
second won't work right now because each load should save new data to a
database. If the backend servers go down, it's okay if we aren't able to
save the data -- we want to at least be able to display a cached copy of
the page.

That said, perhaps Varnish isn't meant for this -- any suggestions?

Thanks!
-Victor


victor.cheng at paperg

Jun 5, 2012, 11:50 AM

Post #2 of 2 (250 views)
Permalink
Re: Possible to cache a page for grace mode despite a TTL of 0? [In reply to]

Hi all,

I was able to resolve this issue by taking a better look at the request
flow here: https://www.varnish-software.com/static/book/VCL_Basics.html

In case anyone runs into this issue, you just have to modify vcl_hit so
that you pass if the backend is healthy (and if it's the particular request
you want to be dynamic except when the backend goes down)

Thanks,
Victor

On Mon, Jun 4, 2012 at 5:17 PM, Victor Cheng <victor.cheng [at] paperg>wrote:

> I'm not sure if this improper usage of Varnish or not, but I'd like to do
> the following for high availability purposes:
>
> I have a page that's dynamic in nature, but I want to be able to serve a
> cached copy of it if the backend servers happen to go down.
>
> Is it possible to do this while setting the beresp.ttl to 0? This seems to
> prevent grace mode and works fine if I set it to 1 (as well as if I set the
> relevant grace mode params), but showing people a cached page for even one
> second won't work right now because each load should save new data to a
> database. If the backend servers go down, it's okay if we aren't able to
> save the data -- we want to at least be able to display a cached copy of
> the page.
>
> That said, perhaps Varnish isn't meant for this -- any suggestions?
>
> Thanks!
> -Victor
>
>

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.