ESI

Put bluntly, having a clear ESI strategy in your template set is paramount to getting your community site to scale.

When dealing with the highly dynamic and user generated content nature of community sites, getting the dynamic bit to scale is "easily" done with ESI. ESI enables you to have different caching policy for different web page fragments and you can thereby improve site performance by differentiating between page content that updates often (e.g. the number of messages in a user's inbox) and less often (such as a news article or blog entry). Big IP, Varnish, Akamai, Oracle Webcache and Squid 3 all support ESI.

You must take heed, however, when developing your JSPs as using ESI means structuring your templates differently and setting the s-maxage HTTP header in entry point JSPs (the ones that receives HTTP requests directly and are not only included by other JSPs).

Because the application developer knows best how long a given fragment should be cached, he/she should tell the cache server how to cache the given fragment. At least with Varnish, you do not need any configuration to make the cache respect this directive in the JSP. This is an example on how to set the cache time of one minute on a fragment.

<%@ taglib uri="http://jakarta.apache.org/taglibs/response-1.0"
  prefix="response"%>
  <response:addHeader name="Cache-Control">
    s-maxage=60
</response:addHeader>