Introduction to JMX
The Java Management Extensions (JMX) specification2 defines a Java optional package for J2SE3 that provides a management architecture and API set that will allow any Java technologybased or accessible resource to be inherently manageable. By using JMX, you can manage Java technology resources. You can also use Java technology and JMX to manage resources that are already managed by other technologies, such as SNMP4 and CIM/WBEM.5
JMX introduces a JavaBeans model for representing the manageability of resources. The core of JMX is the simple, yet sophisticated and extensible, management agent for your Java Virtual Machine (JVM) that can accommodate communication with private or acquired enterprise management systems. JMX also defines a set of services to help manage your resources. JMX is so easy to use and is so suited for the Java development paradigm that it is possible to make an application manageable in three to five lines of code.
Basically, JMX is to management systems what JDBC (Java Database Connectivity)6 is to databases. JDBC allows applications to access arbitrary databases; JMX allows applications to be managed by arbitrary management systems. JMX is an isolation layer between the applications and arbitrary management systems. So why do we need this layer anyway?
2.1 Why We Need JMX
2.1.1 Choosing a Management Technology
As we saw in Chapter 1, many different management technologies are being used in different areas of the industry. CMIP7 dominates the telephony management market. SNMP dominates the device and network management market. Because this book is about developing Java applications and systems, let's narrow our focus to those technologies used by Java-based resources. Most Java-based resources today will be part of applications.
Even though SNMP is supported by some applications and middleware, it is not widely used for application management. One of the most commonly cited reasons for this is that many application vendors and management vendors have felt that the granularity of security in SNMP is not sufficient to use it for configuration updates and sensitive information. Therefore SNMP is often seen as useful only for read-only management of more or less public data and events. SNMP also does not have a natural model for operations on managed resources. Operations must be represented as a settable attribute. Sometimes this can be a difficult representation to map. Dependencies and associations can also be difficult to represent in SNMP.
CIM defines a more natural way to represent management data and addresses some of the weaknesses just described. It has extensive models for systems and devices, but the application management models are still emerging. The fact remains that there is no dominant management technology for the management of applications.
This would not be such a big problem if there were a single, dominant management systems vendor. If that were the case, you could use the management technology chosen by that vendor. Unfortunately, life is not that simple. Today the enterprise and application management market is pretty evenly split between Tivoli Systems8 and Computer Associates,9 who use their own proprietary technology for their manager-agent infrastructure.
If you have to manage an application or resource that runs on only one operating system, or on one vendor's systems, then choosing a management technology can be guided (or dictated) by the preferences of that vendor. Microsoft's Windows,10 IBM's AIX,11 Sun's Solaris,12 and Hewlett-Packard's HP-UX13 each has its own management system. However, one of the great things about Java has been the ease in which applications can be ported to and supported on many different vendors' systems. This means that most Java-based applications run on many platforms. If you are developing managed software products, you may be pressured to support multiple management technologies and systems because every vendor will want you to make your Java resources manageable by its management system.
Just to add to the list of management technologies you need to support, customers may have installed enterprise management systems that they will want to use to manage your application. In fact, they may or may not buy your application, depending on whether or not it can be managed by their existing enterprise management software. Your customers cannot be expected to replace their existing enterprise management systems just to accommodate your application. If you supply your own management system, your customers may still not be happy. They may not want yet another management console to watch and understand just to manage your application. Adding another console mitigates the console consolidation benefits of their enterprise management systems.
If you are a developer or architect working for a vendor of cross-platform applications, you will find yourself between a rock and a hard place. The rock is that your marketplace may be demanding that your software be manageable. To appease that marketplace, the software will need support for multiple management technologies. The hard place is that the cost of developing support for one management technology is expensive. This cost includes the learning curve, design and development, and maintaining currency with those technologies as they continue to advance. The cost of developing support for multiple technologies may very well exceed the potential new sales. This makes the business case for creating manageable applications and systems very hard to maintain and contain.
As a result, the potential return on investment may not motivate you to instrument appropriately for manageability. In fact, you may choose to write your own application-specific management system to solve a particular problem quickly, and not implement it for any external management technology. You can see how this adds to the populations of unique, nonstandard management systems and unmanageable applications.
A single suite of uniform instrumentation for manageability, like JMX, makes it cost effective to develop new applications with management capability. You can use JMX to instrument your Java applications. You can also use JMX to provide access to the manageability capabilities of your non-Java applications via Java Native Interface (JNI) and wrappers. Because JMX is centered on an architecture for pluggable adapters that allow any management technology to manage your resources, you have the best of both worlds: instrumenting your application with one management technology, and being manageable by many different management systems.
2.1.2 Dealing with Diversity
One of the primary challenges in managing applications is their diversity. This diversity is also a challenge for developers! Applications today vary widely in purpose, size, architecture, and criticality. Very little is common across all application types. Application architecture trends are increasing the diversity rather than settling the industry on a few de facto standard approaches.
JMX can be used to enable management of a wide variety of application architectures. JMX allows you as a developer to build your skills on one management technology that you can then apply to lots of application projects, today and in the future. Using JMX to enable this variety of application types benefits management systems vendors as well. They can support JMX well and be able to manage a wide variety of applications. Some of the application types that JMX is suited for are centralized applications, distributed applications, Internet applications, e-business applications, and service-oriented applications.
126.96.36.199 Centralized Applications
Centralized applications, such as payroll and accounting, are backed by a database on a high-end server and usually accessed by a limited set of users, like a financial department. Managing centralized applications entails ensuring high availability and performance throughput because they can be a single point of failure. The clients of these distributed systems are usually other programs, which expect lightning-fast response times.
188.8.131.52 Distributed Applications
Distributed applications, such as mail systems, usually require groups of small and midrange server systems to be running at all times, and they are accessed throughout the enterprise. Managing distributed applications is often a scaling problem: Many, many servers must be managed (i.e., available, connected, and performing well), as well as the networks that connect them, in order to simply ensure the application is available to its users. Generally the clients require proprietary software, so client software distribution and configuration must be managed as well.
184.108.40.206 Internet Applications
The introduction of the intranet/Internet concept precipitated a new class of application that connects the end user to existing, traditional, centralized applications. The new application facilities range from Web-accessible corporate personnel directories to Web-based order-tracking systems that benefit customers and reduce order management costs. These types of applications make it easier to access corporate information inside traditional applications, and they reduce the number of personal contacts necessary. Managing Internet applications entails keeping several layers of applications available to each other and the network: Web servers, application servers, back ends. Browsers must be appropriately configured.
220.127.116.11 E-Business Applications
The next generation of autonomous, Web-based applications is rapidly being developed and deployed in the new business environment. These applications embody e-commerce in the form of catalogs, shopping, marketplaces, and auctions. The move of the supply chain to the Internet will drive the next set of critical, distributed business-based applications. These applications move the heart of the businessbuying supplies and selling productsto the Internet. Managing e-business applications is challenging because applications may span enterprise boundaries and use unreliable protocols like HTTP.
18.104.22.168 Service-Oriented Applications
Service-based architectures are currently emerging where IT resources across the network appear, move, and disappear. Relationships between applications can be just-in-time and fleeting. Managing the dynamic topologies, dependencies, and availability of these applications in this environment will be difficult at best.
Each of these classes of applications has its own management challenges. However, all of these application types execute across multiple hosts, operating systems, and corporations. They incorporate existing traditional and emerging application models. They are no longer just client-server, they are now client-middleware-server. These new application types are business critical, creating the need for them to be uniformly controlled and managed by a business's existing management systems with the same diligence as traditional applications. JMX is flexible and extensible enough to be taken advantage of in all of these diverse types of application architecture.
2.1.3 Being Managed by Multiple Management Applications
As we discussed in Chapter 1, there are many different types of management applications: distribution, inventory, topology, configuration, operations, event, automation, monitoring, and performance. You will probably want your application to be managed by several of these. Without JMX, you might have to implement explicit support for each type of management application. If you're using JMX combined with JMX adapters, the same instrumentation can be used to support and interact with most or all of these applications.
2.1.4 Supporting Application-Specific Management Systems
Your application will need to be installed, configured, monitored, and maintained. This means that you must implement your own management systemthat is, an application-specific management systemthat supports these tasks. Otherwise, you will be dependent on a management system being available in your customer's environment. This dependency may limit sales if some of your customers have a different management system, or even no management system. Applications in the market today have their own proprietary instrumentations to communicate with their internal management systems, as well as instrumentation to connect to other management systems. We've seen how JMX can be used to interact with multiple management technologies and management applications. In the same vein, JMX can be used to drive an internal or application-specific management system, as well as an external management system.