A few days ago, Bas de Nooijer wrote an interesting article “Controlling Varnish ESI inside your application” in which he discusses one of the more interesting aspects of Varnish, Edge Side Includes. Specifically, he discusses how you can control the use of ESIs from within your Zend Framework based application.
For me one of the best features of Varnish is ESI (Edge Side Includes). It allows you to combine elements with different lifetimes into a single page. This way you don’t need to regenerate a complete page as soon as a news listing somewhere on the page changes. And you can still cache pages while displaying user-specific information somewhere on the page.
This lowers the load on your application even further and it can also help in simplifying your application, by focusing purely on the content of the page and loading all other elements via ESI.
The blog post itself is not long and the majority of it is code. It assumes you have Varnish setup and running and understand the concepts involved. This is not a beginner’s article. The sample PHP code is specific to Zend Framework. This means that those not using Zend Framework won’t be able to simply copy and paste the sample code but c’mon, you know you shouldn’t be doing that anyhow.
If you are currently using Varnish in your stack, this is an interesting blog post that may spark your imagination. If you are not, reading the post may just result in you having to install Varnish on your development server to see what all the excitement is about.