Mar 19, 2010

Java Execution Time Measurement Library - JETM

The first part of analyzing the applications with bad performance is to identify the code fragments which are causing the issue. In order to identify them, we will need to find out the execution timings across different pieces of the application. 

To achieve this, we follow one of the following approaches

  • Profile the application using a java profiler.
  • Write log statements to determine the execution times

Profilers can give fine grained information regarding the memory allocation, execution paths and garbage collection behavior.  Profilers add overhead to the execution and often make the applications slower.  So this cannot be used in a real production environment.

The second approach of writing log statements is a time consuming and requires lot of changes to your source code.  This process can be reduced by writing aspect classes which will include log statements and apply advice on various point cuts (AOP approach)

But we always wish that it will be useful if we can have a library which will help us in measuring the execution times with little or no changes to our source code with a very less overhead. 

While exploring this, I have found out that there is a Java Execution Time Measurement Library which perfects fits in this area.

Features of this library

  • Very light weight and free library. 
  • Very low overhead
  • Can be used declaratively or programmatically
  • Can record the data in a flat or nested manner
  • No VM level instrumentation needed
  • Built in http console which can used to view the execution timings in the form of a report
  • Specify the classes (expressions allowed) to be monitored

Best part of it is that we can easily integrate this if you are already using spring framework in your application.  You can make few changes in your spring context files (in a declarative fashion of course) and add one jetm.jar.  You are on your way to collecting the execution times of various classes and methods in your application.

Go ahead and try it out yourself. 


Related Posts


Text Widget

Copyright © Vinay's Blog | Powered by Blogger

Design by | Blogger Theme by