What is ESI ?
Edge Side Includes or ESI is a small markup language for edge level dynamic web content assembly. The purpose of ESI is to tackle the problem of web infrastructure scaling. It is an application of edge computing.
Static Content vs Dynamic Content ?
Let’s assume we have dynamic website having most of the pages are mixture of static and dynamic content. The portion of the page should be un-cacheable and rest of the page should serve from the cache. The question here is, how do you ensure the cache won’t be impacted by having dynamic content on the page. A few possible options are –
Option 1 : Load dynamic content Asynchronously (AJAX)
Option 2 : Load dynamic content using ESI.
I would say both the options are the best, but you should choose based on type of the website and infra considerations . Having said that, let’s talk about the scenarios when to choose what ?