TPTP Profiler and Tomcat Tutorial
Eclipse Test and Performance Tools Platform (TPTP Profiler) works as a plugin to profile applications to identify performance bottlenecks. This tutorial takes you through the steps to profile an application deployed on Tomcat using TPTP and Eclipse. It also contains few tips to analyze the profiling results. The advantage I found with this combination is – a developer can do the profiling task during development stage itself, instead of waiting for a dedicated performance testing phase. Early identification of issue does cost less in a project’s development lifecycle.
This article assumes that you have a project available on Eclipse platform and it can be deployed on the Tomcat server offered with Eclipse. (If not then this link will help you.)
Downloading TPTP Profiler:
One can download the plugin or complete pack of Eclipse with TPTP from the project site – http://www.eclipse.org/tptp/home/downloads/. Other alternative is using Eclipse’s software updates feature. In ‘Software Updates and Add-ons’ dialog box, under ‘available software’ tab, expand Ganymede menu. Under this menu select ‘Testing and Performance’ checkbox as shown below and click on Install. After finishing, it will recommend Eclipse restart. Profile sub – menu added to the project right click options and Eclipse Run menu is a check to successful installation of TPTP.
Starting the TPTP Profiler:
Right click on the project to be profiled, select ‘Profile as’ menu and profile on server sub menu. Select the server and click on finish button. Following dialog box will be displayed to select the profiling options. Select the desired data collection and analysis option. You can direct the output to a file by entering details of profiling data file in Destination tab of the dialog box. After entering the details, click on finish button and the profiling is started. This will prompt to change the Eclipse perspective to ‘Profiling and Logging’ perspective.
Profiling an Application:
Access the application to execute the transactions to be profiled. Complete the business steps on the application and the selected profiling data will be recorded by the tool.
Execution Time Analysis:
As name suggests, it will record the time taken by each method involved in the transaction. Following data is recorded while profiling with TPTP Profiler. If your transaction is hampered on performance then this view can show you the methods that are causing performance problem. You can look for these things while analyzing:
– Any method with comparatively very high time
– Uniform distribution of time across multiple methods
– Common behavior amongst the problem methods
Memory Analysis with TPTP Profiler:
Memory analysis is to check the amount of memory getting allocated when the transaction is executed. Profiler tracks the class instances getting created to record the count, size and the average age. It also gives you live instances count of a particular class. This data can be used to identify -
– If any class instances are getting created in huge number
– Any class instances remaining unnecessary alive even after completion of transaction
– Any class instances getting created in huge numbers and then removed quickly
— Total size of objects (to check if the virtual memory allocated is enough)
Below is example of the memory statistics. (If your perspective does not open the tab then click on circled icon on Eclipse menu.) Filter can be changed by choosing set filter on memory statistics.
Following filter options are available. If your memory analysis screen is not showing any data you can change the filter to ‘no filter’ and the data will start flowing. Edit/New buttons on the Filters screen allow to create filters to view code specific data, e.g. specific packages, classes, methods etc.
Thread Analysis with TPTP Profiler:
Thread analysis is used to monitor the threads spun and lifecycle of these threads. You can see the idle time, hanging threads and wait state of threads to see if any locks are there.
Probe analysis requires probes inserted already. Probes can be inserted through File -> New -> Profiling and Logging and selecting either of Probekit or Symptom probes. This will create a probe file in the project. Edit the probe file and use it for probe analysis.