JMX and MBean Support
JMX refers to the Java Management Extension, a framework for application and network management in the Java programming language. Using JMX technology, a given resource is instrumented by one or more Java objects known as Managed Beans, or MBeans. These MBeans are registered in an MBean server. Through the MBean server, resources exposed via MBeans can be accessed by management applications (JMX clients) in order to:
-
Read and change application parameters during runtime
-
Provide statistical data (performance, resource usage, logs, errors, etc.)
-
Receive notifications in case of errors
-
Monitor critical system components.
Intershop Commerce Management provides a set of predefined MBeans that make it possible to obtain and process system monitoring information from JMX clients such as the MX4J HTTP Adaptor for Tomcat application servers. In addition, Intershop Commerce Management includes a simple mechanism to register additional MBeans provided by custom cartridges.
MBean Registration
A standard MBean consists of a Java interface (with the suffix MBean) and an implementation class. Each cartridge registers the MBeans which it provides. Registered MBeans are then loaded during application server startup and integrated with the MBean server of the underlying application server.
To register MBeans, you have to provide an mbeans.properties file within the classpath directory javasource/resources/<cartridge-name>. The mbeans.properties file defines the respective "MBean-Classname" to "JMX-ObjectName" mappings. The general schema for MBean entries is:
mbean_class_name=mbean_object_name
java.management.ObjectName
(e.g., domain:key1=value1, key2=value2
). The sample below shows the respective configuration entry for the LoggerAdministrationMBean
, provided by the core
cartridge. com.intershop.beehive.core.capi.mbean.LoggingAdmin=com.intershop.enfinity:
name=com.intershop.beehive.core.capi.mbean.LoggerAdministrationMBean,
type=AdministrationMBean
It is possible to replace MBeans of other cartridges by mapping their name to a different implementation class. The order in which the cartridges are loaded decides which MBean will finally be registered. The cartridge loaded last wins.
Java VisualVM and JConsole
JMX Support
properties. Note the port number as you will need it when specifying the JMX connection for both JConsole and Java VisualVM. This will enable JMX support for all Java applications located on a single Tomcat server within your Intershop Commerce Management installation.Here you have the tabs Overview, Monitor, Threads, Sampler and MBeans. A description of each tab is listed below:
- Overview
Here you can see system properties as well as the virtual machine where your application is running and the Java home folder where the application is located.
- Monitor
Here you can see memory and performance, CPU usage, classes loaded and threads.
-
Threads
This tab opens with a view of All Threads on a timeline, and allows you to create a thread dump to save and analyze later. The drop-down menu allows you to see All, Live, Finished and Selected application threads.
-
Sampler
Sampler provides you with a profile of your application performance. You can generate graphs for specific threads, as well as see the objects that are consuming system resources.
-
MBeans
This tab allows you to view all MBeans registered with the platform MBean server. As administrator, you will be primarily concerned with monitoring and performing operations for the following:
- Under
com.intershop.enfinity
, you can view the attributes and monitor application MBeans, attributes of cartridge MBeans and via ClearableCaches you can view and perform operations on the ORM, Object and PageCache MBeans. - Under
oracle.ucp.admin
andoracle.ucp.admin.UniversalConnectionPoolMBean
you can view attributes and perform operations on the Intershop Commerce Management Oracle database pool connections.
- Under
When you select an MBean and view the attributes, where the value is bold, you can double-click the value and it is shown as a graph or chart. For example, some cache MBeans allow you to view the number of cache hits for a particular resource.
Open JConsole in the Intershop Commerce Management folder located in engine\jdk\bin. Double-click jconsole.exe. JConsole automatically monitors the VM on the Tomcat server in which the application is opened. You can connect to a different host at any time by selecting Connection | New Connection and entering the necessary information. The table below lists the tabs and the monitoring options:
Tab | Monitoring Focus |
---|---|
Overview | Here you can see Heap Memory Usage, Threads, Classes loaded and CPU Usage graphs for the Tomcat server where your application is running. You can select a Time Range (12 hours, 1 day, 7 days, etc.) from the drop-down (or by right-clicking any of the objects) in the application window. |
Memory | The memory tab allows you to see charts (change the displayed information in the drop-down at the top), displaying memory use versus time and specific memory pools. You can also view specifics in the 'Details' window. |
Threads | Here you can see the current, highest number, live daemon threads as well as the total number of application threads. Select the thread you want to view from the 'Threads' window in the bottom-right of the application window. Garbage Collection is available in the upper right of the application window. Note: Garbage collection (GC) is the process of releasing memory used by objects no longer being referenced. It can have dramatic effects on performance. See Oracle JConsole documentation for more details.
|
Classes | View the number of 'Loaded Classes' in chart form for the selected 'Time Range'. |
VM Summary | This tab displays the Uptime (total amount of time since the Java VM was started), process CPU (total amount of CPU time), and the time spent in JIT compilation. |
MBeans | Shows all registered MBeans. When you select an MBean in the tree, its attributes, operations, notifications and other information is displayed on the right. Display a chart of an attribute's value versus time by double-clicking on the attribute value. |
Intershop Commerce Management Sample MBeans
Intershop Commerce Management already exposes a variety of resources through a set of predefined MBeans, making it possible to monitor important parts of the system using JMX management applications. With the current release, MBeans are included with the cartridges core and monitor. Mbeans provided by these cartridges are contained in the package com.intershop.beehive.<cartridge_name>.capi.mbean. See the JavaDocs installed by Intershop Commerce Management for these cartridges (in <IS.INSTANCE.SHARE>/system/cartridges/<cartridge_name>/release/docs/api) for details on the attributes and operations exposed by the MBeans. A summary is provided in the following table.
Cartridge | MBean Interface | Description |
---|---|---|
core | DatabaseDriverInformation MBean | Drivers (oracle.jdbc.driver.OracleDriver, com.ibm.db2j.jdbc.EmbeddedDriver) Pool size, connection count |
core | LoggingAdminMBean | Enabled log scopes. Operations to remove or add log scopes. |
core | OracleDataSourceInformation MBean | General data source informationOracle connection cache information |
core | ORMCacheInformationMBean | General information about the OR Mapping's persistent object cache |
core | ORMCacheInformationObject MBean | Information on individual persistent objects (e.g., number of instances in cache, default reference type, etc.) |
core | JobsMBean | Used to handle jobs. |
core | PipelinesMBean | Used to reload pipelines via JMX. |
monitor | ProcessInformationMBean | Process information (general process information, Web front service information, important environment variables), resource usage (CPU usage, total process size, in-memory size, used system threads), Java VM resource usage (total heap size, used heap size), threads (thread group, name, thread name, priority, daemon, alive), system properties |
monitor | SessionRequestInformation MBean | Session persistence enabled, number of active sessions, average number of sessions per day, total number of requests, etc. |