Friday, May 25, 2012

Open source Live Profiling of Java ?



There are a lot of tools for profiling Java and the following is a list:

  • HPROF
           http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
           $java -agentlib:hprof[=options] ToBeProfiledClass
           You get a dump AFTER running your application. This is not a live heap watching.

  •  Jmap, jps
         With command line tools  Jmap,jps you do not need to download anything. This comes with JAVA2SE.
         You must know the pid of the Java application to
  • EurekaJ and BTrace
           You can add inside Java code annotations to be gathered by BTrace.

  • AspectJ

         This is the preferred method.

Generally any metric-gathering can take up to 2500 nanoseconds, so use it only when necessary. For example disc access takes 40 milliseconds, servlet processing up to a second so adding 2500 nanoseconds for each of the methods would be negligible.

However the best way is to use AOP for performance monitoring and metric gathering consider JMetrix 
From AspectJ you can read the following:

3. What are some common development aspects?
Aspects for logging, tracing, debugging, profiling or performance monitoring, or testing.

4. What are some common production aspects?
Aspects for performance monitoring and diagnostic systems, display updating or notifications generally, security, context passing, and error handling.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog.
    Really very informative post you shared here. Kindly keep blogging.
    If anyone wants to become a Java developer learn from Java Training in Chennai.
    or learn thru Java Online Training in India .
    Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete