Saturday, April 25, 2009

Page speed

At the very bottom of many web pages, you'll see a like that states: "This page was generated in X.XX seconds." This is measured by a little snippet of timing code. Here is an example of that code for JSP (and/or Coldfusion). In other words is is a practical "how to" measure the page generation time.

1. Add Exec time filter to your web application (download and save .jar file in your /WEB-INF/lib directory, add filter’s description to web.xml file

2. Describe a mapping for this filter (see examples here). Actually this mapping describes the files (pages) covered by the measurement.

3. On your JSP page deploy Exec Time taglib:

<%@ taglib uri="taglib.tld" prefix="calc" %>

Page generated in <calc:ExecTime /> ms

No comments: