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

Mailing List Archive: Varnish: Misc

Handle ESI-includes on cached page

 

 

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


arkharov at gmail

Jul 11, 2013, 10:35 AM

Post #1 of 3 (103 views)
Permalink
Handle ESI-includes on cached page

Hi Everyone.

I have a question about ESI includes in Varnish 3. I have 2 types of cache
which stored in Varnish:
1) page cache,
2) blocks cache.

Every page contains several blocks. Pages are generated by script index.php
and have TTL 15 minutes (set by HTTP header max-age). Blocks are generated
by script blocks.php and have TTL from 1 to 5 minutes. Blocks are included
to page by ESI instructions like:

<esi:include src="/blocks.php?block=some-name" />

I've read manual on varnish-cache.org (
https://www.varnish-cache.org/docs/3.0/tutorial/esi.html) and different
tutorials, but I've not found: is it possible to handle ESI instructions on
every request to cached page? In cause of page has TTL more than blocks,
blocks are updated only when page cache flushed.

As far as I understand from this presentation:
http://www.slideshare.net/neorey/varnish-the-high-performance-valhalla-9321198(slides
33-34) ESI-includes can be handle only if request served from
backend, because only in this case vcl_fetch called, am I right?

Thank you.
Roman Arkharov
arkharov [at] gmail


perbu at varnish-software

Jul 11, 2013, 12:49 PM

Post #2 of 3 (105 views)
Permalink
Re: Handle ESI-includes on cached page [In reply to]

Hi Roman,

On Thu, Jul 11, 2013 at 7:35 PM, Roman Arkharov <arkharov [at] gmail> wrote:
(..)

> I've read manual on varnish-cache.org (
> https://www.varnish-cache.org/docs/3.0/tutorial/esi.html) and different
> tutorials, but I've not found: is it possible to handle ESI instructions on
> every request to cached page? In cause of page has TTL more than blocks,
> blocks are updated only when page cache flushed.
>

Yes. See below.

As far as I understand from this presentation:
> http://www.slideshare.net/neorey/varnish-the-high-performance-valhalla-9321198(slides 33-34) ESI-includes can be handle only if request served from
> backend, because only in this case vcl_fetch called, am I right?
>

Not quite. The parser is only run when the document is fetched. When the
document is parses it is stored more or less like a list of pointers to
"esi fragments" in memory. When it is delivered these are more or less just
spit out. If one of these fragments time out they are refetched and
replaced.

So, you can have a static parent page with at TTL of 24h and within it
dynamic fragments.

I'll make a note out of going through the docs and see if I can make it a
bit more clear.

--
<http://www.varnish-software.com/> *Per Buer*
Phone: +47 958 39 117 | Skype: per.buer
We Make Websites Fly!

Winner of the Red Herring Top 100 Europe Award 2013


arkharov at gmail

Jul 12, 2013, 3:38 AM

Post #3 of 3 (93 views)
Permalink
Re: Handle ESI-includes on cached page [In reply to]

Per, thank you for your answer.

I found the reason of my problem with blocks cache, it was in my
application. My app sets HTTP header: "Vary: Cookie". When I added line:

unset beresp.http.Vary;

to my vcl_fetch (or removed this header from app) problem gone.

Thank you again for your help.

Roman Arkharov,
arkharov [at] gmail

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.