Skip to main content

Java Performance Monitoring Libraries

There is a proposal to build performance probes in WSO2 Platform. For that I started looking in to some performance monitoring libraries.

Following libraries were mentioned in the WSO2 architecture thread.
While looking in to these libraries, I found out about following also.

Here is a quick comparison of each project. These comparison criteria are based on the requirements in above proposal.



Metrics ParfaitJAMonJava SimonPerf4J
LicenseApache License 2.0Apache License 2.0JAMon LicenseNew BSD LicenseApache License 2.0
SourceGitHubGoogle CodeSourceforgeGitHubGitHub
Latest Version3.1.00.2.82.794.0.00.9.16
Last PublishedSep 4, 2014Jun 01, 2011Aug 20, 2014Oct 29, 2014Oct 16, 2011
Java Version-Java 6-Java 7-
CountsYesYesYesYesNo
TimingsYesYesYesYesYes
JMX SupportYesYesNoYesYes
Enable/DisableNoNo*YesYesYes*

* Not confirmed

Let's look at each library in brief.

Metrics


Metrics provides various measuring instruments. 
  • Meters - Measuring rate of events over time
  • Gauges - Instantaneous measurement of a value
  • Counters - Measurement for counting
  • Histograms - Statistical distribution of values
  • Timers - Measures the duration of a code block and the rate of invocation.
  • Health Checks - Centralizing the health checks of services

Metrics has modules for common libraries like Jetty, Logback, Log4j, Apache HttpClient,
Ehcache, JDBI, Jersey.

Metrics provides a way to have multiple reporting options. Mainly JMX, Servlets (http), Console, CSV and SLF4J.  It also supports Ganglia and Graphite reporting

Metrics' Getting Started page shows you how to use the Metrics APIs.

Parfait


Parfait provides mechanisms for collecting counter and timing metrics. Data can be exposed via various mechanisms including JMX and the the open-source cross-platform Performance Co-Pilot.

Parfait also has number of modules, which enable to collect metrics from common data sources.

JAMon


JAMon provides various ways to monitor applications without code changes. It has in built support for HTTP Monitoring, Spring, JDBC, Log4j, EJB etc. JAMon can be used in Servlets, JSPs, EJBs and Java Beans in various Java EE Application Servers.

JAMon doesn't seem to support JMX.

Java Simon


Java Simon has monitors called Simons, which can be used in the code to count something or to measure the time taken.

It's interesting to know that the Java Simon was started by the people, who used JAMon earlier. They were not satisfied with JAMon in terms of simplicity and monitor structure. Some people also consider Java Simon as the replacement of JAMon.

Java Simon also measures time in nanos. Simons are organized in a hierarchy.

Simons can be disabled easily. 

Java Simon has a web console in addition to exposing data via JMX. There are many examples for Java Simon usage and Getting Started wiki is a good place to see how we can use the APIs.

There is comparison of Java Simon with JAMon, which shows performance overhead of each library.

Perf4J


The Perf4J mainly makes use of the logging frameworks and it has support for popular logging frameworks.

The Perf4J support is limited only to timing metrics and I didn't find the support for counters.

Summary


In this blog post, I just wanted to give an idea about Java Performance Monitoring libraries and each library has pros & cons. So, depending on the project requirements, it's better to evaluate all libraries and select a suitable one for your project.

There is lot of information in each project's web pages. Going through those pages will help to understand more about features provided by each library.

Comments

Popular posts from this blog

Finding how many processors

I wanted to find out the processor details in my laptop and I found out that there are several ways to check. For example, see The RedHat community discussion on  Figuring out CPUs and Sockets . In this blog post, I'm listing few commands to find out details about CPUs. I'm using Ubuntu in my Lenovo ThinkPad T530 laptop and following commands should be working any Linux system. Display information about CPU architecture $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 58 Model name: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz Stepping: 9 CPU MHz: 1199.988 CPU max MHz: 3600.0000 CPU min MHz: 1200.0000 BogoMIPS: 5787.1...

Java Mission Control & Java Flight Recorder

Last year, I got two opportunities to talk about Java Mission Control & Java Flight Recorder. I first talked about " Using Java Mission Control & Java Flight Recorder " as an internal tech talk at WSO2 . I must thank Srinath for giving me that opportunity. After that, Prabath also invited me to do a talk at Java Colombo Meetup . Prabath, Thank you for inviting me and giving me the opportunity to talk at the Java Colombo Meetup! I'm also very excited to see that Marcus Hirt , the Team Lead for Java Mission Control has mentioned about the Java Colombo Meetup in his blog post: " My Favourite JMC Quotes ". It's so nice to see "Sri Lanka" was mentioned in his blog post! :) From Marcus' Blog Here are the slides used at the meetup. Java Colombo Meetup: Java Mission Control & Java Flight Recorder from Isuru Perera Marcus Hirt's blog posts really helped me to understand JMC & JFR concepts and his tutorials were very helpful...

Flame Graphs with Java Flight Recordings

Flame Graphs Brendon D. Gregg , who is a computer performance analyst , has created  Flame Graphs to visualize stack traces in an interactive way. You must watch his talk at USENIX/LISA13 , titled Blazing Performance with Flame Graphs , which explains Flame Graphs in detail. There can be different types of flame graphs and I'm focusing on  CPU Flame Graphs  with Java in this blog post. Please look at the Flame Graphs Description  to understand the Flame Graph visualization. CPU Flame Graphs and Java Stack Traces As  Brendon  mentioned in his talk, understanding why CPUs are busy is very important when analyzing performance.  CPU Flame Graphs  is a good way to identify hot methods from sampled stack traces. In order to generate CPU Flame Graphs for Java Stack Traces , we need a way to get sample stack traces. Brendon has given examples to use jstack  and Google's lightweight-java-profiler . Please refer to his perl program on g...