Designing Manageable Applications Get a Grip on Your Application: It is clear that the term “manageability” can mean many different things to different com- How the use of standard-based technologies greatly munities of users. A framing definition of “manageability” will enhance the manageability of software applications help developers judge how much of it to build into any one application. The “level of manageability” With the increasing complexity and intricacy of corporate busi- that is required by an application determines what technologies to use and how much effort to ness environments, it’s no wonder that IT groups everywhere find expend on this aspect of the application design. costs tougher to control and services more difficult to assure. The Definition: “Manageability” is the ability to answer is designing and developing software applications so they exercise administrative and supervisory actions and receive information that is relevant to such are readily manageable. actions, on a component. Manageability is further distinguished by by Justin Murray found in the emerging standard, Log4J. three functional parts: Logging messages is the base level of manage- evelopment managers familiar with ability of an application, so consider it worth 1.Monitoring – the ability to capture runtime software process improvements know doing in your application, but make sure the and historical events from a particular com- Dthat the cost of finding and fixing operational staff will understand your mes- ponent, for reporting and notification development problems increases as an applica- sages and not be overwhelmed by them. It is 2.Tracking – the ability to observe aspects of tion reaches use by customers. The same prin- easy for management console products to pick a single unit of work or thread of execution ciple is true for the cost of managing applica- up and filter these messages so that operators across multiple components (e.g. tracking tions in deployment. The costs of diagnosing can make sense of them. Should two copies, or messages from senders to receivers) runtime problems and determining their solu- instances, of the application be required to be 3.Control – the ability to alter the runtime tions increases with respect to the phases of the run in parallel, then the log file method will behavior of a managed component (e.g. application life cycle. need more design attention, such as locking of changing the logging level of an application). To help reduce costs and deliver high-quality the file between writes done by the separate applications, developers can design for better instances, for example. Manageability provides a mechanism to manageability in the application itself. This Application manageability is not limited to ensure that an application is both alive and article introduces several ways to develop better knowing simply whether the application is functioning normally, as well as that of check- programs by designing and implementing man- alive, or whether the application has produced ing an application’s performance over time. agement capabilities into programs and encom- an error message in its log file. For certain When a runtime problem occurs, management passing two levels of support, for the platform applications, it is important to know how many tools enable an engineer to troubleshoot the and the application level. The article looks at user transactions the application processed, problem. The three aspects of manageability the various industry-standard technologies that how long each transaction took, and what per- shown above are used in subsequent sections of are available to the developer to use. centage of them failed to complete, among this document to assess various technologies. other matters. Further, manageability covers the monitoring, Application Manageability Sophisticated applications may have queues of tracking and control of more than one instance It’s easy to believe that an application is incoming requests, some of which are outstand- of the same software. For example, applications manageable if it can produce messages in a ing and some being currently processed. An IT that are built on J2EE-compliant application text log file. Log files can be sufficient for the system administrator may need to know the con- servers are frequently replicated on several management of very simples types of applica- dition of each queue, so that problems can be computers for load balancing and fault toler- tion deployments, but this is a primitive man- solved quickly. Should a queue of incoming ance. IT operators need to monitor and control agement technique and does not afford any requests be causing delays to the end user, for the levels of activity of each one of these significant application control. develop- example, the administrator may wish to allocate instances at all times. They can then decide to ers, for example, build logging into applica- some of those requests to another identical re-route requests or take other actions to allay tions through the use of features such as those process queue, thus avoiding a problem. problems and attain service level agreements. Key Design Decisions in Manageability SNMP defines a client-server relationship. SNMP is useful framework for managing The decisions the developer must take in applying The client program (called the network manag- applications. As its acronym suggests, the pro- manageability functionality to his/her software are: er) makes virtual connections to a server pro- tocol is simple enough that adding SNMP to an • What level of information is most useful to gram (called the SNMP agent) that executes on application is a reasonable endeavor. the operator of the software? a remote network entity (often a device, but • What actions can be taken on the software this could be an application platform also). Common Information Model as a result of this information? Agents provide information to the network (CIM) and Web-Based Enterprise • What level of detail (fine grained access to manager regarding the remote entity’s status. Management (WBEM) individual objects, or coarser grained access An SNMP agent is therefore required on each The Distributed Management Task Force to subsystems, modules or otherwise) is best machine on which an application is running, to (DMTF) is a standards body of senior repre- for application manageability? monitor that application or component. sentatives from Cisco, Novell, Sun, IBM, HP • Is the management software to be allowed to The database of management information and several other companies. The DMTF pub- interact synchronously with the application that is used and controlled by the SNMP agent lishes several standards that together provide code or must all actions be taken “after the fact”? is referred to as the SNMP Management interoperable management for systems, Information Base (MIB), and is a standard set devices, networks and software applications. There are varying levels of sophistication of statistical and control values. We can think Among these standards are the Desktop that developers can achieve when designing of this as a database of records that are com- Management Interface (DMI), the Alert and implementing manageability into an appli- posed of name-value pairs, each of which can Standard Format (ASF), System Management cation. For example, HP OpenView Operations describe a property of a managed object. BIOS (SYMBIOS), Directory Enabled (OVO) can “encapsulate” messages written to SNMP traps are events that are generated Networking (DEN), WBEM and its associat- log files. This level of manageability may pro- when something of interest happens in a man- ed common information model, CIM. The vide sufficient details about the application aged object that is described in a MIB. To han- DMTF has developed a core set of standards characteristics, but requires some integration dle a trap, an application sends a request to the for enterprise management that make up effort. This level qualifies as “monitoring” or management station to have the event forward- WBEM. WBEM includes a data model, “tracking” but not “control”. ed. The programmer does not need to write called the CIM standard. WBEM is the Another level of sophistication is to embed code to poll for traps — the management agent implementation of the CIM management monitoring API calls in the application to com- just sends the traps to the network management model specification. municate directly with the management plat- station(s) as instructed by the program. The CIM specification details a language form. An example of this is the use of the Management agents may send repetitive traps. and methodology for describing management “operations console message” API to write Custom software on the network management data. The CIM schema includes models for messages from an application to an OpenView station is frequently used to filter these trap systems, applications, networks and devices. management console. This level can provide messages using certain criteria and deal with The CIM schema enables applications from finer- grained details of application behavior, the most important ones. developers on different platforms to describe but requires more development time. The An application cannot, however, rely on management data in a standard format. It can developer must take care with this API not to SNMP traps alone. For example, if an agent then be shared between varieties of manage- flood the operations console with too many dies, it cannot tell the manager that it is dead. ment applications. detailed messages. Therefore it is a good idea to poll agents period- The xmlCIM Encoding Specification Encapsulation methods are useful when an ically just to see if they are alive and well. This defines XML elements, in the form of a organization cannot afford to extend an appli- imposes some extra work on the developer. The Document Type Definition (DTD) that can cation with new interfaces. Embedding calls to SNMP trap technology has two significant be used to represent CIM classes and a management framework is preferable when issues that the developer should be aware of: instances. The “CIM Operations over HTTP” more fine-grained control is needed. specification defines a mapping of CIM The following sections discuss the standards 1.The unreliability of the transport (UDP) can operations onto HTTP, allowing implementa- technologies that developers of manageable cause messages to be lost tions of CIM to interoperate in a standard applications will consider using. 2. SNMP traps will continue to be sent repeat- manner. We can regard CIM as the specifica- edly until they are acknowledged by the tion for which WBEM provides the imple- Simple Network Management receiving party—perhaps causing flooding mentation. WBEM is built into the Microsoft Protocol (SNMP) to happen. Windows operating system. This network and system management proto- WBEM goes beyond similar network man- col is in widespread use today for software and There are technologies available on the mar- agement standards such as SNMP and DMI, device management. It was invented in the ket that fall under the general category of and defines the following specifications: 1970’s, and was enhanced to SNMPv2 in the “extensible SNMP agents”. These usually 1980’s. The most prevalent network and system include a development kit that automates sub- • a rich model of manageable entities featur- management tools that exist today support agent development. Based on a Master ing inheritance and associations (the SNMP. This proves to be one of the reasons Agent/Subagent architecture, they allow sub- Common Information Model, or CIM) why many developers are attracted to working agents to be loaded and unloaded dynamical- • an extensible set of operations that can be with SNMP to make their applications man- ly at run-time. These technologies can ease performed on these objects (CIM Operations) ageable — many products are available as the the task of developing an SNMP-aware sys- • a protocol to encode the objects and operations management toolkit. tem or application. for communication over a network (xmlCIM) To use a WBEM/CIM approach, the develop- The Instrumentation level contains managed the connectors and other adapters that allow a er is required to first model the required man- bean objects, or MBeans. These are Java management console to extract data from a aged objects in an object-oriented style. Then objects that conform to either: JMX server, not through direct manipulation the developer maps his/her managed applica- • a simple style of object construction in the Java of the MBeans themselves. tion objects into the common information world called JavaBeans (for simple MBeans) The MBean mechanism is powerful in the model, or a derived extension of it. • a JMX standard called “Dynamic MBean” sense that it provides an industry standard There are many other details and initiatives that for more flexible management method for “wrapping” a business object, with the DMTF is pursuing. These standards activities • the JMX “Model MBeans”, which are an another MBean object, the latter being dedicat- will help put meaningful structure to the use of man- extension to Dynamic MBeans that provide ed to manageability. The alternative approach agement technologies in specific domains. Space more generic templates for management is to allow the business object to conform to does not permit a full treatment of this subject in this instrumentation MBean interfaces itself. article, but readers are encouraged to learn more at the DMTF website (www.DMTF.org). Conforming to the JavaBeans format is A JMX-compatible Smart Plug-in straightforward. It requires that an object is (SPI) for HP OpenView Operations The Java Management Extensions serializable and has a null constructor. It is HP enhances application manageability by pro- (JMX) Standard common practice to implement “getter” and viding a specific Smart Plug-in (SPI) module that The Java Management Extensions have “setter” methods on all that object’s attributes integrates the management of an application envi- become the accepted standard in the industry for that must be visible to external management ronment with the management of the platforms on managing Java applications. The specification for tools. Creating MBeans in this style means that which it depends (operating system, JVM, appli- JMX within the Java Community Process (JCP) once the MBeans are registered with the JMX cation server). The SPI integrates several sources is a Java Submission Request (JSR) (JSR3). A server, called the MBean server, those MBeans of information into one management tool. It: separate specification, JSR77, which is part of the can be reached for monitoring and control pur- J2EE 1.4 specification, is a description of the poses by the tools at the distributed- services • Gathers data from any supplied MBeans, "model" of objects that each application server layer at the top of the diagram. such as those supplied by an application serve must expose through JMX. The JMX specifica- JMX requires the use of an MBean server • Performs calculations on that data to be tion provides for the construction of manageabil- shown at the Agent Level in the diagram. An more meaningful to the end operator ity of Java applications in a standard way. application server process supports this • Brings filtered application logging mes- MBean server functionality. The MBean serv- sages to bear on the management task at the The JMX environment is composed of three er handles the management messages that are same time. levels of software: flowing to and from objects that have been previously registered with it as MBeans. This provides a highly desirable management • the instrumentation level Certain properties of the object that conforms integration, as many IT operations departments • the agent level to the MBean interface can then be viewed by need to monitor the health of their computers, • the distributed services level management tools and, provided the developer networks, application servers and any applica- of the MBean has allowed it, the behavior of tions that depend on them from the same con- These levels are shown in the Figure 1 (the the object can be changed, using functionality sole, using the same, familiar tools. distributed services layer is the topmost one). of management consoles. This is done through This HP SPI makes use of the JMX MBean server supplied by the application server and derives some of its information from the MBeans registered with that server. Developers can use the SPI in three ways:

• Existing information (contained in existing MBeans) may be used to provide information through existing OpenView Operations-sup- plied metrics. There are 55 such metrics available for use by the IT operator. Examples of such metrics are the number and percentage of available JDBC connections. • Existing information may be used to define new user-defined metrics (UDMs). • New, custom-built MBeans may be designed by the application developer to provide new information through new metrics. This last approach applies in those situations where business-specific metrics require action by operations personnel. An example would be the number of customers who did or did not Figure 1. A model of the JMX specification. purchase items at a website in the past day. The application developer can, if necessary, add his/her own metrics using the features of the OVO console. By defining one’s own met- rics, a developer helps the operator to monitor the applications by allowing new combina- tions of data to be derived from existing sources. We see therefore that this tool can monitor and control both the application serv- er platform and with some user coding, the application itself.

Writing Custom Application-Specific MBeans The JMX capabilities leave the software designer with the problem of deciding which application objects are in need of management visibility and which are not. Should all busi- ness objects be capable of being manipulated through their associated MBean features, or just a chosen few? The software designer has the option of map- ping one MBean to one or to many business objects, depending on the need for manage- ment of them. Each business object can alter- Figure 2. OpenView Transaction Analyzer screens. Highlighted in red is the key culprit for per- natively be constructed to inherit the MBean formance concerns within this particular application. This tool fulfills the final requirement for capabilities, but this will mean that each such the application developer in building manageability into an application; that of tracking the paths object will need to register with the MBean through the code. server. This can lead to scalability issues. If one business object depends completely Tracking in a J2EE Application with performance bottlenecks. The application on another to get the work done (i.e., they are OpenView Transaction Analyzer developer has to make no changes to code to in a “uses” relationship), then there is an Many developers are concerned with finding carry this process out. Figure 4 gives a snapshot argument for managing them using one the bottlenecks in their applications that inhib- of the types of screen that HP’s OVTA product MBean. Correspondingly, if objects are it better performance. This is not an easy task, produces to aid the developer in performance entirely independent of each other in the due to the distributed nature of these applica- analysis. It can quickly trace down to the point business context, the designer can choose to tions. One mechanism to instrument your of the problem in a complex application. have a management view of each one, using application is to embed calls to the Application separate MBeans or MBean interfaces for Response Measurement (ARM) API in an Summary those objects. application. This API is designed to allow for To reduce IT operations costs and deliver It is unlikely that all objects in any system detailed accounting of CPU time spent in sec- high-quality applications, developers must will need a dedicated MBean of their own. The tions of the application. Use of this API can be design their applications for manageability. software designer chooses the Java object or intrusive on the application design, however, Applications supporting management capabili- EJB to visualize and control using a manage- and require attention from the developer in ties will perform better and production issues ment tool. Finally, the developer will register areas where he/she is not an expert. can be diagnosed and cured more quickly. the new MBean with the appropriate MBean There are now tools on the market, such as the Varying levels or manageability are available server process. OpenView Transaction Analyzer (OVTA), that through the SNMP and JMX standards and From that point onward, the MBean is man- make use internally of ARM’s accurate measure- through integration with management tools ageable using JMX-aware tools. The associated ment and logging techniques without the need like OpenView Operations business object is manageable to the degree that for explicit calls to the ARM API and without Armed with this suite of management capa- its guardian MBean or interface determines its application code changes. These tools exploit bilities, developers can make their applications behavior. As an example, the HP OpenView purpose-built Java class loaders and byte-code better suited for deployment. In the long run, Smart Plug-In technology provides management manipulation to intercept JSP, EJB, and servlet this helps both IT operations staff and develop- of the J2EE application server’s internal objects, method entry and exit points. The ARM API is ment organizations. without the application developer having to do used at these points in the instrumented code and extra coding work. Using the OpenView SPI to is therefore completely hidden from the applica- About the Author extend the metrics it supplies to the operator tion developer, yet the degree of timing accuracy Justin Murray is a technical consultant at HP. gives you a powerful tool for enhancing the man- provided by ARM is maintained. He has taught and delivered consulting to HP ageability of your application. There are more This proves to be a very powerful method of customers and staff on a variety of subjects details available on the customization of MBeans analyzing the full J2EE application at develop- including optimizing performance of Java and in the HP OpenView developer documentation. ment time, or even later at deployment time, for web-services applications.

Reprinted with permission INTERNETNEWS.COM, May 29, 2003. 303852 Copyright 2003 by Internet.com Corporation. All rights reserved. For reorders, call 651-582-3800.