From Wikipedia, “ESI or Edge Side Include is a tiny markup language for edge level dynamic web content assembly. The purpose of ESI is to tackle the problem of web infrastructure scaling.” It is incredibly useful and can help to provide services for your web sites or web applications.

You can find the ESI plugin for Apache Traffic Server here. When I tried to compile it and make it work with traffic server 3.0.4, I got some errors. Even when I manage to compile it, the runtime is not actually working, too.

So i decided to try to fix it. Here are the list of problems I find and fix.

  1. Some “if” statements are checking whether the TS functions are returning 0 or not but actually we should check against TS_SUCCESS or TS_ERROR
  2. TSFetchUrl is still requiring ip and port as parameters so we need to pass them in
  3. VConnWrite() should use INT64_MAX instead of INT_MAX. This is causing the ESI template with ESI include to return with a 2^32 -1 content length and causing the client to hang till timeout.
  4. There is a mechanism to cache a parsed version of ESI template through a POST request internally but I find it hard to get it working. I can’t get my ESI template with a valid cache control header to get properly cached in ats (which is somewhat useful to what i do). So I try to disable that.

The working code can be found here. My fixes for #4 is quite hacky and there are actually lots of things we don’t need if we don’t do the internal POST request. So there will be more cleanup needed.

The plugin seems to work well. I tested with ESI try/attempt/except syntax in my ESI response. I tested with multiple ESI includes. I tested with cache control header added for the ESI response so that I get the ESI Response cached in ats and subsequent requests will simply get the ESI response from cache instead of OS server. Gzip is also working, too.

Next time, I will talk about a few use cases that makes ESI incredibly useful for web sites and web applications.

 

The people working on Apache Traffic Server apparently had put out some plugins. You can find them here. I downloaded the code and try to compile them. You need the setup mentioned in my previous post. I can successfully compiled a couple (e.g. regex_remap and header_filter). Unfortunately some of the more interesting plugins fail to [...]

 

Apache Traffic Server is really quite awesome. It competes really well against Varnish and Squid. So after running some experiments with those two, it is time to install an ATS and see how it works under similar settings. There is no rpm provided. So we have to build our own software from the source code. [...]

 

Following up the post – “Setting up Varnish on EC2” I needed to repeat some of the experiments on Squid. Thus I need to setup Squid as well on EC2. Similar to the reasons stated in the Varnish post, Cloud-init is the right choice. To do that, on AWS console, I create a new instance. [...]

 
Nostalgia Post - VDB - A database for Dreamcast VMU

Back in 1999, Dreamcast is a big deal. I still admired some of the advanced feature of that console, such as online gaming (with modem), voice chat, the funny/innovative Seaman game, 4 controller ports and the funny little VMUs. VMU is the memory card for Dreamcast, a neat platform itself with 4-way d-pad, 2 buttons [...]

 
Nostalgia Post - Game FAQ for San Goku Shi Taisen DS

San Goku Shi Taisen DS is absolutely one of the greatest gems for Nintendo DS. It is just a shame that there is no decent guide or FAQ in English for this game. Granted, you will need to read quite a lot of Japanese and read it fast in order to play well, read others’ [...]

 
Photo Sticker

Photo Sticker is a Facebook app that I have been working on since March 2008. It allows users to drag-and-drop some stickers onto a photo they own and put the decorated (or vandalized!) photo onto their profile page. Back in 2008, developing Facebook App is like this  – OAuth is not used in Facebook App. [...]

 

Back when I am working on my master degree in 2003, I am fascinated with computer graphics. Lots of interesting techniques, such as image texturing, shadow rendering, particle systems, etc. So here is my attempt to make a simple 3D game. Jet Racer is a 3D game in which player has to control a vehicle [...]

 

Recently I need to setup Varnish on Amazon EC2 and run some simple experiments with it. It is tedious to install all the software every time I start up an instance. But setting up an AMI or CloudFormation template is too much work and too heavy for such a simple task. So using the Cloud-init [...]

 
Nostalgia Post - YAP Friend Game

Back in 2009, Yahoo! introduced the Yahoo! Application Platform (YAP). It was a lookalike to the Facebook Application Platform back then. They have YML and YQL, which were just very similar to FBML and FQL. Unfortunately Yahoo! did not keep the innovation going. I think by now the only real valuation thing coming out of [...]

© 2012 Random Bits & Bytes Suffusion theme by Sayontan Sinha