ESI: Edge Side Includes

Web page caching gets tricky once personalization is involved. Lets take twitter public_timeline for example which seems to be perfect for caching. Unfortunately when a user is logged in, it also shows the user’s information. Caching that particular page in its entirety, on the web server, in such scenarios, may not be an option. Another scenario is where parts of a page might expire faster than other (require different cache TTLs). Here again caching the whole page doesn’t help.

Edge side includes(ESI) is a markup language specifically designed to help web servers assemble dynamic content at the web layer.

<esi:include src=""/>

The above ESI tag is similar to tags in jsp/php/etc which allow one page to refer to another page for parts of the content on the page. By breaking up the page into smaller objects the webserver could apply different TTL settings (and user validation) to different parts of content. Twitter used to (and may still ) use “Varnish” which supports a subset of ESI specification out of the box.

But caching on the webserver may not be the real reason why this language was invented. ESI is also supported by Akamai  (CDN) on its edge caching product.  By allowing Akamai edge nodes to do the assembling close to the user, they significantly improve perceived end user performance without giving up personalization or content freshness requirements.

3 comments on “ESI: Edge Side Includes

  1. Good post, the other aspect that complicates it here is HTTPS. Quite often its only a small part of the page that we need to use HTTPs but for a variety of reasons you end up having to use HTTPs for the whole page which meses with the caching story.

  2. Thats a very good point. However, Akamai and most CDNs can still cache Secure objects (I have seen this in action). Infact I’ll be surprised if they can’t take a mix of HTTP and HTTPS objects in ESI and generate one big HTTPS page for each user.

Comments are closed.