Chapter 24. Set Up Java Management Extensions (JMX)
24.1. About Java Management Extensions (JMX)
Java Management Extension (JMX) is a Java based technology that provides tools to manage and monitor applications, devices, system objects, and service oriented networks. Each of these objects is managed, and monitored by
JMX is the de facto standard for middleware management and administration. As a result,
JMX is used in Red Hat JBoss Data Grid to expose management and statistical information.
24.2. Using JMX with Red Hat JBoss Data Grid
Management in Red Hat JBoss Data Grid instances aims to expose as much relevant statistical information as possible. This information allows administrators to view the state of each instance. While a single installation can comprise of tens or hundreds of such instances, it is essential to expose and present the statistical information for each of them in a clear and concise manner.
In JBoss Data Grid, JMX is used in conjunction with JBoss Operations Network (JON) to expose this information and present it in an orderly and relevant manner to the administrator.
24.3. JMX Statistic Levels
JMX statistics can be enabled at two levels:
- At the cache level, where management information is generated by individual cache instances.
- At the CacheManager level, where the CacheManager is the entity that governs all cache instances created from it. As a result, the management information is generated for all these cache instances instead of individual caches.
In Red Hat JBoss Data Grid, statistics are enabled by default in Remote Client-Server mode and disabled by default for Library mode. While statistics are useful in assessing the status of JBoss Data Grid, they adversely affect performance and must be disabled if they are not required.
24.4. Enable JMX for Cache Instances
At the Cache level, JMX statistics can be enabled either declaratively or programmatically, as follows.
Enable JMX Declaratively at the Cache Level
Add the following snippet within either the <default> element for the default cache instance, or under the target <local-cache> element for a specific cache:
24.5. Enable JMX for CacheManagers
At the CacheManager level, JMX statistics can be enabled either declaratively or programmatically, as follows.
Enable JMX Declaratively at the CacheManager Level
Add the following in the <global> element to enable JMX declaratively at the CacheManager level:
24.6. Disabling the CacheStore via JMX When Using Rolling Upgrades
Red Hat JBoss Data Grid allows the CacheStore to be disabled via JMX by invoking the
disconnectSource operation on the
See Also: RollingUpgradeManager
24.7. Multiple JMX Domains
Multiple JMX domains are used when multiple CacheManager instances exist on a single virtual machine, or if the names of cache instances in different CacheManagers clash.
To resolve this issue, name each CacheManager in manner that allows it to be easily identified and used by monitoring tools such as JMX and JBoss Operations Network.
Set a CacheManager Name Declaratively
Add the following snippet to the relevant CacheManager configuration:
<globalJmxStatistics enabled="true" cacheManagerName="Hibernate2LC"/>
MBean represents a manageable resource such as a service, component, device or an application.
Red Hat JBoss Data Grid provides
MBeans that monitor and manage multiple aspects. For example,
MBeans that provide statistics on the transport layer are provided. If a JBoss Data Grid server is configured with
JMX statistics, an
MBean that provides information such as the hostname, port, bytes read, bytes written and the number of worker threads exists at the following location:
MBeans are available under two
jboss.as - these
MBeansare created by the server subsystem.
jboss.infinispan - these
MBeansare symmetric to those created by embedded mode.
MBeans under jboss.infinispan should be used for Red Hat JBoss Data Grid, as the ones under jboss.as are for Red Hat JBoss Enterprise Application Platform.
A full list of available MBeans, their supported operations and attributes, is available in the Appendix
24.8.2. Understanding MBeans
JMX reporting is enabled at either the Cache Manager or Cache level, use a standard
JMX GUI such as JConsole or VisualVM to connect to a Java Virtual Machine running Red Hat JBoss Data Grid. When connected, the following
MBeans are available:
If Cache Manager-level
JMXstatistics are enabled, an
jboss.infinispan:type=CacheManager,name="DefaultCacheManager"exists, with properties specified by the Cache Manager
If the cache-level
JMXstatistics are enabled, multiple
MBeansdisplay depending on the configuration in use. For example, if a write behind cache store is configured, an
MBeanthat exposes properties that belong to the cache store component is displayed. All cache-level
MBeansuse the same format:
In this format:
Specify the default name for the cache using the
cache-modeis replaced by the cache mode of the cache. The lower case version of the possible enumeration values represents the cache mode.
component-nameis replaced by one of the
JMXcomponent names from the
- Specify the default name for the cache using the
As an example, the cache store
MBean for a default cache configured for synchronous distribution would be named as follows:
Each cache and cache manager name is within quotation marks to prevent the use of unsupported characters in these user-defined names.
24.8.3. Registering MBeans in Non-Default MBean Servers
The default location where all the MBeans used are registered is the standard JVM MBeanServer platform. Users can set up an alternative MBeanServer instance as well. Implement the MBeanServerLookup interface to ensure that the
getMBeanServer() method returns the desired (non default) MBeanServer.
To set up a non default location to register your MBeans, create the implementation and then configure Red Hat JBoss Data Grid with the fully qualified name of the class. An example is as follows:
To Add the Fully Qualified Domain Name Declaratively
Add the following snippet:
<globalJmxStatistics enabled="true" mBeanServerLookup="com.acme.MyMBeanServerLookup"/>