Profiling our web application with TPTP

Using a profiler tool is a good way to find out bottlenecks inside our Web Application. Today I want to recommend one tool I'd used in the past. There might be more suitable tools but for now I will describe very quickly the one I know: TPTP (Test and Perfomance Tools Platform).

In my own words, a profiler tool allows you to have statistical data to prove what you may had known (maybe intuitively) for a long time but you need some fancy tool to blame someone else's code, hopefully not yours :). Getting serious, having a tool to collect data and summarize it for us is pain relief when we need to accurately point out which part of our application is degrading our performance.

First download and install Eclipse's TPTP. It can be downloaded in an “all-in-one” package with Galileo's version version.

Open the project you want to profile in Eclipse and use the profile option to start project:

Righ click in project -> “Profile As“ -> “Profile Configurations...”

Select the “Tomcat 5.x” option:

Select the type of analysis. In this case we are selecting the “Execution Time Analysis”

Select the “Edit Options” to select the level of detail for the analysis:

There are some other options that can be configured. Finally click on “Profile”. Eclipse will start Tomcat server and the “Profiling and Logging” perspective will open.

Double click on “Execution Time Analysis”to open Statistical Summary table:

Once profiler is running, we need to navigate locally in the site in order to run through all the code and collect all the data from different classes.

This analysis measures the amount of time (in seconds) consumed by every method.of every class. In the summary table only the highest 10 base time packages are displayed.

Base Time: The amount of time (in seconds) the method has taken to execute in all calls made by application. Not including the execution time of any other methods called from this method (sub calls to other methods).

Average base time: It is the base time divided by the number of calls made.

Cumulative base time: The amount of time (in seconds) this method took to execute in all calls made by application. Including the execution time of any other methods called from this method.
Always: Cumulative Time ≥ Base Time