What is ESI ?
ESI (Edge Side Includes) is a system which allows content assembly by a web accelerator (Akamai, F5, Varnish, Squid ...). If you are familiar with the concept of SSI with Apache then you will quickly become familiar with ESI as the concept is more or less the same.
What problem does ESI solve ?
The most common use case is the following (I will take the most trivial one). Imagine you have a page with an article, and at the top of the page you want to display 'Hello Mr John Smith' where John Smith is the name of the user who is visiting the page. When you want to service the page with your web accelerator you have a problem because the page is personnalized. So basically you can not cache the page in your web accelerator (I know you could use JavaScript for that trivial use case bla bla bla bla). So what can you do if you still want your web accelerator to service the page ? What if you could ask your web accelerator to still keep the article cached, but call a module dedicated to display 'Hello Mr John Smith' ? This is where ESI comes into play. The web accelerator will keep a cached copy of the article but by using a specific set of XML tags it will be able to call the 'hello xxxx' module and insert the result in the final page before servicing it to the user.
How does ESI work ?
Well, that is quite simple. By using a bunch of specific tags your web accelerator will process them, insert the result in the HTML page and will finally service it to the client. Let's take an example with the <esi:include [...]/> :
- the webserver will return an HTML page with a tag <esi:include src="http://path/to/something" [...]/>
- the web accelerator will parse the HTML, find the <esi:include [...]/> tag
- the web accelerator will call the URL defined in the src attribute and insert the result in the HTML page where the <esi:include [...]/> tag has been defined of course
- the web accelerator will service the final page to the client.
Where can I get ESI support ?
ESI is supported by vendors such as Akamai and F5 but the requirement here is to get ready to sign a (big) check ;). ESI is also supported by free open source softwares such as Varnish and Squid. However this is not because it is supported by these vendors/softwares that the specification is fully supported. The only vendor I know who support the specification completely is Akamai (F5 as well ? If you know other vendors who support ESI completely, please let me know). Squid and Varnish have only a very limited support of the language.
So what can I do with it ?
If you plan to use the <esi:include [...]/> tag only then you can use Varnish but you have to know it has a very limited support of this tag and will ignore errors silently. If you plan to use more than <esi:include [...]/> then you do not have much choice, you have to use vendors like Akamai and this costs money. Sometimes it makes sense to sign a check to get a quick solution "now" if "now" is definitely important to you. However you have to take the long run into account as well. Using a feature which is not completely supported by different vendors/softwares introduces the risk of being locked with a specific vendor/software. Conclusion ----------
I personally see ESI an numeric equivalent to cigarettes. So it is better for your health not to taste. Use ESI only if this is the very last solution you can use.
Useful links
- ESI language specification
- Introduction to ESI by F5
- ESI support by Varnish (only esi:include and esi:remove so far)
'Hope that helps :)
Comments !