Monday, June 1, 2009

Etags - request header tags to speed up your site .

An ETag (entity tag) is an HTTP response header returned by an HTTP/1.1 compliant web server.

There are 2 possible implementations :
1. Shallow Etag
           - An MD5 hash is computed for first request from the response content and set in the response header by the web filter.For subsequent requests, the filter retreives the previous etag and checks with the new etag computed using the response content.

Minuses:
   -etag is computed after page is rendered on the server.
   - Doesnt work for pages with dynamic content per request (like date/time).
   Spring 3 has this support. It is called ShallowEtagHeaderFilter.

2. Deep Etag
     -This avoids page computation at a much granular level. Uses hibernate interceptors and is not so straightforward to implement. Spring 3 is yet to support this approach.


References:
infoq article


No comments: