Welcome!

Java IoT Authors: Pat Romanski, Elizabeth White, Liz McMillan, Yeshim Deniz, Mehdi Daoudi

Related Topics: Java IoT

Java IoT: Article

Making Optimal Use of JMX in Custom Application Monitoring Systems

Some best practices and recommendations

With the release of Java 1.5, JMX is built-in and readily usable in even the smallest of applications. It's now a simple task to instrument nearly any application and expose important monitoring metrics. Custom applications, involving many processes and multiple middleware components, may be effectively managed from a remote console. As a result, there's been an explosion of data exposed through JMX and available for analysis and presentation.

As the use of JMX expands, one would expect that mistakes be made and lessons learned the hard way. Software developers are usually much more familiar with their own application domain and are often not experts in monitoring and management tools.

The SL Corporation and I have over 20 years of experience in monitoring and visualization applications, with particular expertise in Java. The company's Enterprise RTView product has been specially adapted to deal with real-time data produced by JMX-enabled applications and has features to compensate for many overlooked requirements.

This article discusses errors that have been repeatedly seen in JMX implementations regarding the content and design of data structures known as MBeans. Common JMX best practice knowledge is briefly reviewed to provide some initial context. This is followed by a detailed discussion about issues that arise when custom application monitoring requirements grow to include aggregation, analysis, and visualization in real-time. Recommendations are then offered that may help users make optimal use of JMX in these situations.

Common Best Practices
JMX is a very general solution framework and doesn't define specific monitoring or management data structures. This puts the burden on developers to establish conventions themselves to extract and process information consistently so it can be analyzed and visualized.

Best practice documents for JMX typically suggest adherence to common standards regarding naming conventions, data types, deployment constraints, portability, and so on. These suggestions fall into several categories:

MBean Usage Conventions
Specific conventions should be applied to MBean names and JMX data types to implement MBeans that are portable, i.e., commonly available JMX client applications can handle them without issue. Generally, this means one should follow the guidelines for using standard domain and key names (such as type= and name=) and OpenMBean data types instead of custom Java classes (for ease of deployment). These suggestions are presented in depth in Sun's discussion of JMX best practices.

MBean names should be predictable and used in a consistent manner when representing a hierarchy. Most importantly, one should define the same attribute schema for all beans of the same type or at the same level in a hierarchy. It's obvious that a violation of this principle will result in complications for client applications.

Use Standard MBeans wherever possible; these are the simplest to implement and the easiest to maintain, since JMX implicitly understands data types and run-time behavior simply from the Java source directives. There are situations where Dynamic and/or Model MBeans may be necessary, but their use should be kept to a minimum.

Follow Established Design Patterns
Use well-established design patterns for defining MBeans. Several of these are described in Design Patterns for JMX and Application Manageability. Often, the motive behind these patterns is to shield users of JMX MBeans from the details of their implementation or even their attribute structure. This lets the developer change the MBean's details without affecting client applications.

Other patterns are useful in maintaining separation between the monitoring and management code contained in the JMX MBean and the business logic in the application. There are significant advantages in terms of maintainability if the application being monitored has little or no knowledge of how the monitoring is done.

Much has been written about Aggregator beans as a way to minimize the number of MBeans that a client has to connect to and query. When the number of beans reaches into the thousands, performance issues come into play. The Aggregator pattern is one way to improve performance by minimizing MBean access.

Model After Established Systems
The most popular J2EE application servers make extensive use of JMX as a tool for managing their internal functions. These very large systems provide solid ground for testing implementation techniques for JMX MBeans. As such, they provide excellent examples to follow.

In the administration system for the BEA WebLogic Server, there can be over a thousand different MBean instances. MBeans have been developed to address just about every variation of monitoring and management problem. By exploring the techniques used in this system, much can be learned and applied to your own requirements. The BEA JMX system is especially complete when it comes to the use of notifications for monitoring system performance.

The J2EE Management Specification JSR-77 defines a Management Model and provides useful guidelines for data types and implementation patterns. Effective management and monitoring involves states, statistics, metrics, relationships, and more. Understanding these information structures can be helpful in developing quality systems.

Monitoring, Analysis & Visualization Issues
The best practices outlined above are useful, but they don't fully address issues that come up in large-scale monitoring applications involving visualization and, in particular, dynamic analysis of real-time data. Requirements, such as trending or slice-and-dice data analysis, are often afterthoughts. It's important to understand these issues upfront and develop an implementation plan that minimizes the work required to present the data. Often, this can influence the design of the MBeans developed for such an application.

The best way to illustrate this is with a concrete example. Consider developing a monitoring system for a sample application, a simple message switching system. This example is representative of many applications. Similar data structures are relevant for monitoring the performance of routers, message boxes, caching systems, object databases, even CEP engines. Shared among them is the desire to use JMX for instrumentation.

Our sample device supports multiple channels for message traffic and collects metrics and statistics about its operation in real-time, so performance can be optimized. Table 1 shows a simple data structure containing information that might be exposed via a JMX MBean for a single channel.

The Total Msgs Sent/Rcvd counts would typically be represented as a long integer since the number could grow larger over time. The memory usage could be stored as an integer since the Java memory limit on many machines is 1GB, so 32-bits will handle that effectively. The other data - Channel ID and Statistics - are stored as strings.


More Stories By Tom Lubinski

Tom Lubinski founded SL Corporation in 1984 and is currently the company's president and CEO. He has been instrumental in developing SL's Graphical Modeling System software and Enterprise RTView, a real-time monitoring, analytics and visualization platform. Since founding the company, he has been involved in thousands of successful customer deployments of real-time visibility solutions. Prior to starting SL Corporation, Tom attended the California Institute of Technology and developed a substantial consulting practice specializing in object-oriented programming and graphical visualization systems. He has over 30 years of experience in the development of computer hardware systems and software applications.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DSR is a supplier of project management, consultancy services and IT solutions that increase effectiveness of a company's operations in the production sector. The company combines in-depth knowledge of international companies with expert knowledge utilising IT tools that support manufacturing and distribution processes. DSR ensures optimization and integration of internal processes which is necessary for companies to grow rapidly. The rapid growth is possible thanks, to specialized services an...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...