BT

Your opinion matters! Please fill in the InfoQ Survey!

Article: Performance Analysis and Monitoring with Perf4J

| by Dio Synodinos Follow 3 Followers on Apr 23, 2009. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

In this article Alex Devine explains how Java developers can take advantage of Perf4J, an open source toolset for adding code timing statements and for logging, analyzing and monitoring the results.

In today's world of service-oriented architectures and widely distributed applications, detecting the component responsible for a performance bottleneck can be exceedingly difficult:

Consider what happens on the server in the relatively common scenario of a typical web 2.0-style application:

  1. An incoming web request is dispatched to the component responsible for generating the response.
  2. The request may need to be authenticated against an LDAP server.
  3. The controller component makes queries against a database.
  4. The controller component also makes calls to a third-party web service.
  5. The controller component aggregates all of the retrieved data into a set of business objects for display.
  6. The business objects are rendered and the response is sent to the user's browser.
  7. AJAX code running in the browser causes additional requests to be sent back to the server

Perf4J is an open source toolset for adding Java server-side code timing statements and for logging, analyzing and monitoring the results. As Alex notes:

For those developers who are familiar with logging frameworks such as log4j or java.util.logging, an analogy helps to describe Perf4J:

Perf4J is to System.currentTimeMillis() as log4j is to System.out.println()

Read the full article: Performance Analysis and Monitoring with Perf4J

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Great Tool! by Doug Ly

Hi,
This is a great tool to keep track of the performance of our service layer.
My boss definitely like the statistics and how heavy the app is being used :-)
One bad thing is that the Google Chart API gets nuked when the request URI is too long!
Doug

Nice Graph by Srinivas Venkatappa

Tool looks very promising for performance analysis. Very useful tool for developers to test the performance, especially for developers practicing Agile.
I would like the tool to progress in the direction of analyzing the database calls, as most of the performance problems are seen in the database areas.

Nagios support of JMX? by Keith Doyle

Thx Alex for great overview of Perf4J.
I am curious though on the comment regarding Nagios support of JMX. My investigation shows that this is particularly difficult, unstable and 'hacky' See www.agilejava.com/blog/?p=149 (not written by me btw). Would it be possible to elaborate on the approach used to tie perf4j jmx logs to nagios that has been adopted by Homeaway?
Keith

Re: Nagios support of JMX? by Alex Victoria

Hi Keith,

The basic Nagios/Cacti usage that we have at HomeAway relies on MX4J's HTTP JMX Adaptor. The server exposes the Perf4J data as described in this article using MX4J.

We then use simple command-line bash scripts to ping the XML MX4J interface from Nagios and Cacti. From there its simple to integrate into both of these products. Thanks to Perf4J, we have performance related alerts and historical charts (above and beyond the ones provided by Per4J) in these other applications.

Hope this helps.
Alex

Perfect tool by Srinivas Reddy

We have just finished a big project and we had to add all the bioler plate code to get some numbers for DB calls and other places where there is a delay. This would have been a perfect fit for that. But i am going to get my feet wet with this in my new project (small one though).

Thanks for such a nice tool.

Re: Nagios support of JMX? by Philip Gardner

Hi Keith,

Alex is right; MX4J exposes pretty much all the data we need in an easily consumable format. By adding "&template=identity" to the end of any MX4J url everything is output into XML. We then use a number of simple Perl scripts that consume that XML and run checks against our thresholds specified in Nagios. It's simple, but it works. We do the same thing for Cacti.

I've taken a look at some of the Nagios plugins you've linked to before and basically came to the same conclusion as you, as far as their usefulness.

If you have any other questions let me know.

Philip

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

6 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT