Sunday, July 15, 2012


Overview of Java SE Monitoring and Management

This chapter introduces the features and utilities that provide monitoring and management services to the Java Platform, Standard Edition (Java SE platform). The features introduced here will be expanded upon in the following chapters of this guide.

Key Monitoring and Management Features

The Java SE platform includes significant monitoring and management features. These features fall into four broad categories.
  • Instrumentation for the Java Virtual Machine (Java VM).
  • Monitoring and Management application programming interfaces (API).
  • Monitoring and Management tools.
  • The Java Management Extensions (JMX) technology.
These categories of monitoring and management features are introduced further in the next sections.

Java VM Instrumentation

The Java VM is instrumented for monitoring and management, enabling built-in (or out-of-the-box) management capabilities that can be accessed both remotely and locally. For more information, see Chapter 2, Monitoring and Management Using JMX Technology and Chapter 5, SNMP Monitoring and Management.
The Java VM includes a platform MBean server and platform MBeans for use by management applications that conform to the JMX specification. These are implementations of the monitoring and management API described in the next section. Platform MXBeans and MBean servers are introduced in Platform MXBeans and Platform MBean Server.
Example code is provided in the JDK_HOME/demo/management directory, where JDK_HOME is the directory in which the Java Development Kit (JDK) is installed.

Monitoring and Management API

The java.lang.management package provides the interface for monitoring and managing the Java VM. This API provides access to the following types of information.
  • Number of classes loaded and threads running.
  • Java VM uptime, system properties, and VM input arguments.
  • Thread state, thread contention statistics, and stack trace of live threads.
  • Memory consumption.
  • Garbage collection statistics.
  • Low memory detection.
  • On-demand deadlock detection.
  • Operating system information.
In addition to the java.lang.management API, the java.util.logging.LoggingMXBean API provides allows you to perform monitoring and management of logging.

Monitoring and Management Tools

The Java SE platform provides a graphical monitoring tool called JConsole. JConsole implements the JMX API and enables you to monitor the performance of a Java VM and any instrumented applications, by providing information to help you optimize performance. Introduced in the J2SE platform 5.0, JConsole became an officially supported feature of the platform in the Java SE platform, version 6.
Some of the enhancements that have been made to JConsole between these two releases of the Java SE platform are as follows.
  • JConsole Plug-in support, that allows you to build your own plug-ins to run with JConsole, for example, to add a custom tab for accessing your applications' MBeans.
  • Dynamic attach capability, allowing you to connect JConsole to any application that supports the Attach API, that was added to the Java SE platform, version 6.
  • Enhanced user interface, that makes data more easily accessible.
  • New Overview and VM Summary tabs, for a better presentation of general information about your Java VM.
  • The HotSpot Diagnostic MBean, which provides an API to request heap dump at runtime and also change the setting of certain VM options.
  • Improved presentation of MBeans, to make it easier to access your MBeans' operations and attributes.
JConsole is presented in full in Chapter 3, Using JConsole.
Other command-line tools are also supplied with the Java SE platform. See the Monitoring Tools section of the JDK Development Tools document for more information.

Java Management Extensions (JMX) Technology

The Java SE platform, version 6 includes the JMX specification, version 1.4. The JMX API allows you to instrument applications for monitoring and management. An RMI connector allows this instrumentation to be remotely accessible, for example by JConsole.
For more information, see the JMX technology documentation for the Java SE platform. A very brief introduction to the main components of the JMX API is included in the next sections.

No comments: