Edge Side Includes - Review

serpent_driver

Well-Known Member
#1
This a review about ESI and could help others if they want to use ESI with Litespeed Cache, if there is no plugin available.

Litespeed says ESI works like burning holes in a page if someone is using LScache. In this case such holes will not be cached. If a plugin is used there is no need to think about how ESI works with Litespeed. It works, that's it, but if there is no plugin availabe it will be a hard job to get it run. The reason why it is so difficult is caused by Litespeed itself, because all published information about ESI and how it can be used together with Litespeed are mostly wrong and incomplete. The gratest error in all published information is the compatibility to official specification at W3C. Litespeed's interpretation of ESI is very different to the official spec at W3C.

Litespeed uses the same cache-tags like <esi:include> or <esi:inline> and the same attribute names like src="" or name="", but with self-defined values and a different function. It takes more than a view days for me to check this out. It was like a try and error work and very frustrating!!! @George Wang knows what I am talking about. I was "asking him holes in his stomache...". ;)

For me and in my case it was a special competition because I didn't know if ESI && Litespeed works with Smarty (Template Engine) and at Litespeed support also nobody knew that. Now I know Smarty doesn't matter, so ESI and Litespeed Cache should work with all other template engines. There is nothing special to do if a template engine is used.

The most importent experience for me was the result of the consequences if ESI is used. If ESI is needed be careful with the number of (holes). Evry ESI fragment == hole reduces the time for page load substantially.

Example:
**************
LScache without ESI: Page load time for the main document == 30ms
LScache with ESI and 1 hole (for shopping cart) == 250ms
Litespeed without LScache == 600ms

To keep the speed of LScache I did a trick. As long nobody presses the add to cart button my shop is running without ESI. If it is pressed a cookie will be set and this cookie activates a rule in .htaccess to enable ESI.

ESI is a good idea and it works with Litespeed Cache, but think about if it is really needed!

A request to Litespeed team: Please update information about ESI in LS wiki
 
Top