Java Application Monitor API 2.2 reviewDownload
Java Application Monitor (JAMon) project is a free, simple, high performance, thread safe, Java API that allows developers to easily
Java Application Monitor (JAMon) project is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications. JAMon can be used to determine application performance bottlenecks, user/application interactions, and application scalability.
JAMon gathers summary statistics such as hits, execution times (total, average, minimum, maximum, standard deviation), and simultaneous application requests. JAMon statistics are displayed in the clickable JAMon Report. Click JAMon report to see a live demo of JAMon.
JAMon was developed primarily for monitoring J2EE applications, however it can be used in any JDK 1.2 or higher environment. JAMon can be used in Servlets, JSP's, EJB's and Java Beans in various J2EE Application Servers (Sybase's EAServer, and BEA's WebLogic,…), and can also be used in other programming environments that can call Java code (ColdFusion, PowerBuilder, BroadVision, ...).
Feel free to continue reading the user's guide or download JAMon and read the Java Docs.
Using JAMon is easy. Place JAMon.jar (90K) in your classpath, and surround the code that you wish to monitor with the JAMon API's start() and stop() methods. See the code sample below:
...Code Being Timed...
For example, to collect statistics for all JSP pages in a Web Application, a developer would place a call to the start() method at the top of every JSP, and a call to the stop() method at the bottom. With a few minutes work the developer will have statistics for all application pages. The statistics will include number of page hits, average page execution times, and the number of users simultaneously accessing each page. The statistics can be displayed as an HTML table by calling the getReport() method, or using JAMonAdmin.jsp.
JAMon requires no special administration accounts. Many monitoring tools require administrative accounts to install monitoring software, and to view statistics. Due to the complexity of these tools, developers typically go through specially trained administrators to access monitoring statistics. Many of these monitoring tools also require holes punched in firewalls.
JAMon has none of these problems. Statistics gathered via JAMon are available to all developers via JAMonAdmin.jsp. No administrative accounts, rights, or set-up are required for gathering and viewing statistics. Because the JAMon API is part of the application code, developers can switch J2EE App Servers and monitoring will continue to work. JAMonAdmin.jsp is accessed via HTTP and so can be viewed without punching any additional holes in firewalls.
JAMon can be used to monitor production systems. Monitoring production systems is important because it is the only way we can see the frequency that our code is being executed by real users. Also, many times the configuration of the production environment is different from the test environment, so the performance numbers between the two environments may be considerably different. For both these reasons monitoring only the test environment is not enough.
Unlike many monitoring tools, JAMon, due to its minimal performance overhead and multi-threaded capabilities, can be used in production systems. JAMon can be disabled at runtime (using JAMonAdmin.jsp), further reducing performance overhead. On a 2 Ghz Pentium IV, JAMon's start(), and stop() methods execute 500,000 times per second. After disabling, the methods execute 30,000,000 times per second.
To test JAMon's performance download JAMon.jar and execute the following command. The number represents how many times start(), and stop() should be called in the various tests (100,000 will be used as the default if a number is not provided).
java -cp JAMon.jar com.jamonapi.TestClassPerformance 500000
The last label ("Full Factory TimingMonitor()") in the output indicates how long it takes to run when monitoring is enabled, and the label starting with "NullMonitor2()" indicates how long it takes to run when monitoring is disabled.
JAMon is flexible. Many monitoring tools specialize in monitoring specific parts of an application. This can force a developer to resort to using multiple monitoring tools to cover all of their monitoring needs. For example, a developer may have to use different tools to monitor each of the following: page hits, EJB invocations, method calls and database connections,... .
JAMon's start() method takes a string as an argument. This string can be a JSP page name, an EJB name, a method name or any other code or concept that can be represented by a string.
Also, because strings are passed to the start() method, a developer can decide what to monitor based on runtime data. Using this technique we can monitor trends as well as performance bottlenecks. Some examples of JAMon's flexibility:
Keep statistics for a JSP home page
- Monitor mon=MonitorFactory.start("HomePage");
Keep statistics for a DataAccess class's openConnection() method (which opens a database connection)
- Monitor mon=MonitorFactory.start("DataAccess.openConnection()");
Keep statistics for each user that logs into our system
- Monitor mon=MonitorFactory.start(getUserName());
Keep statistics for all page accesses by date. For example, "pageAccesses.05/10/02"
- Monitor mon=MonitorFactory.start("pageAccesses."+getTodaysDate());
What's New in This Release:
This release fixes a few bugs and adds the new JAMon JDBC driver, which allows developers to monitor JDBC/SQL without changing any code.
Java Application Monitor API 2.2 search tags