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.
Here is a quick comparison of each project. These comparison criteria are based on the requirements in above proposal.
* Not confirmed
Let's look at each library in brief.
Metrics has modules for common libraries like Jetty, Logback, Log4j, Apache HttpClient,
Ehcache, JDBI, Jersey.
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.
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.
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.
Following libraries were mentioned in the WSO2 architecture thread.
While looking in to these libraries, I found out about following also.
- Java Simon - Simple Monitoring API
- Perf4J
Here is a quick comparison of each project. These comparison criteria are based on the requirements in above proposal.
Metrics | Parfait | JAMon | Java Simon | Perf4J | |
---|---|---|---|---|---|
License | Apache License 2.0 | Apache License 2.0 | JAMon License | New BSD License | Apache License 2.0 |
Source | GitHub | Google Code | Sourceforge | GitHub | GitHub |
Latest Version | 3.1.0 | 0.2.8 | 2.79 | 4.0.0 | 0.9.16 |
Last Published | Sep 4, 2014 | Jun 01, 2011 | Aug 20, 2014 | Oct 29, 2014 | Oct 16, 2011 |
Java Version | - | Java 6 | - | Java 7 | - |
Counts | Yes | Yes | Yes | Yes | No |
Timings | Yes | Yes | Yes | Yes | Yes |
JMX Support | Yes | Yes | No | Yes | Yes |
Enable/Disable | No | No* | Yes | Yes | Yes* |
* 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 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.
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 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