javaperformanceaopjmxperf4j

Have you used Perf4J to collect and analyze performance metrics in Java app?


Did you use Perf4J in your Java application to collect and analyze performance stats?

What was the typical pattern (using log files, utilities, UI, JMX, etc.)?

Did you use annotations and AOP-based features?

Did you use any JMX integration?

How did you handle production configuration?

Did you include performance stats views/reports as a feature in your application?

Please tell if and why you decided on alternative library/approach.


Solution

  • I am using Per4j to monitor webservice endpoint performance and also internal service and dao class performance.

    I mainly just log the raw performance statistics to a daily rolling file. Then i use the jar on the command line to analyse the data with different timeslices as i please. I often use the -g commandline option to output a html file which i can then open up and view the data visually which is really useful.

    I enjoy using Spring AOP with the @Profiled annotation. It makes timing very clean. I had a few doubters regarding perf4j degrading performance, and i could easily offer that i could turn the logging off by removing the TimingAspect from my Spring applicationContext.xml file.

    <!-- just remove and all uses of @Profiled do nothing -->
    <bean id="timingAspect" class="org.perf4j.log4j.aop.TimingAspect"/>
    

    Becareful about the mean value and note the max value. While doing performance tuning, we had a method call having wild values with a large standard deviation. Most of the values were around the median, however there were a sprinkling of calls which were 100x more than the average. More of user error than anything, but watch out.

    I use theAsyncCoalescingStatisticsAppender with a timeslice of 15000, but hardly read the log. Because i have the raw performance logs, I can chop and change that by running perf4j on the command line.

    I tried out the JMX integration and it works as promised from the documentation. But I have no real use at the moment for it.

    I have plans to expose the data using SNMP and if it's useful i'll contribute.

    In all, i recommend Perf4j.