POST requests to ESIs

Caunter, Stefan scaunter at topscms.com
Wed Jan 12 19:39:07 CET 2011


Hello all!

 

Consider this scenario: You have a piece of content that has commenting
on it. The comments are highly dynamic, but the content of the page
itself is basically static. ESI works great here to load all the
comments with a TTL of zero.

 

However, there is a comment form on this page as well. If a comment
submission is made, by default Varnish will pass the POST request
through to the backend. But on a site that is heavily commented, this
means loading up that full page for each POST unnecessarily. The only
piece of the page that has changed is the comment ESI, which could very
well accept that POST request itself and do the processing, thereby
lowering the number of requests to the backend.

 

I see in the ESI code that it is hard coded that all ESI requests are
GET requests. Some ESI implementations allow you to specify a method in
the tag (e.g., <esi src="foo" method="POST" />). I was thinking it would
be handy if Varnish could support this, or something similar. Some way
of parsing a POST request as it comes in, and possibly routing it to
the ESI that can accept it. Or maybe even something more abstract than
that; a way to further customize the ESI request in the vcl.

 

Thoughts?

 

Thanks for your time!

 

James

 

Hi,

 

Sorry for lack of indents (outlook at work).

 

Even on heavily commented sites, the number of POSTs for new comments
will be low per second. Issue always seems to be pulling comments for
each page load. Loading comments with a GET, with a ttl > 0 seems to
work well for us (no ESI). Is there a reason you are running with TTL at
zero?

 

You could attempt to do real time updating, with ttl = 0, but your
database and backends won't scale very well, and we find that users will
accept a few minutes of delay for comments to update, and performance is
better. YMMV.

 

/Stefan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110112/8d8c60f4/attachment-0003.html>


More information about the varnish-misc mailing list