Java Management Extensions (JMX)

1. Intro

eXist now provides access to various management interfaces via Java Management Extensions (JMX). JMX is a standard mechanism available in Java 5 and 6 (though there are some differences between the two versions). A agent in the Java virtual machine exposes agent services (as so called MBeans) which belong to different components running within the virtual machine. A JMX-compliant management application can connect to the agent and access the available services in a standardized way. The standard Java installation includes a simple client, jconsole, which will also display the eXist-specific services. However, we also provide a command-line client for quick access to server statistics and other information.

Right now, eXist only exports a limited set of read-only services. Most of them are only useful for debugging. This will certainly change in the future as we add more services. We also plan to provide write access to configuration properties.

2. Enabling the JMX agent

To enable the platform server within the host virtual machine, you need to pass a few Java system properties to the java executable. The properties are:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Note

This option makes the server publicly accessible. Please check the Sun JMX documentation for details.

The extension can be activated by passing a command-line parameter to the exist start scripts (client.sh startup.sh etc.)

-j <argument>, --jmx <argument>

set port number through which the JMX/RMI connections are enabled.

Some examples:

bin/startup.sh -j 1099
bin\server.bat -jmx 1099

Note

In the Sun Java SE 6 platform the JMX agent for Local monitoring is enabled by default.

3. Monitoring and Management

3.1. Use jconsole

Once you restarted eXist, you can use a JMX-compliant management console to access the management interfaces. For example, I can call jconsole, which is included with Java 5 and 6:

jconsole localhost:1099

Clicking on the MBeans tab should show some eXist-specific MBeans below the standard Java MBeans in the tree component to the left.

3.2. Use JMXClient

eXist includes a simple command-line JMX client which provides a quick access to some important server statistics. The application accepts the following command-line parameters:

java -jar start.jar org.exist.management.client.JMXClient <params>

-a, --address <argument>

RMI address of the server.

-c, --cache

displays server statistics on cache and memory usage.

-d, --db

display general info about the db instance.

-h, --help

print help on command line options and exit.

-i, --instance <argument>

the ID of the database instance to connect to

-l, --locks

lock manager: display locking information on all threads currently waiting for a lock on a resource or collection. Useful to debug deadlocks. During normal operation, the list will usually be empty (means: no blocked threads).

-m, --memory

display info on free and total memory. Can be combined with other parameters.

-p, --port <argument>

RMI port of the server

-s, --report

Retrieves the most recent sanity/consistency check report

-w, --wait <argument>

while displaying server statistics: keep retrieving statistics, but wait the specified number of seconds between calls.

The following command should print some statistics about cache usage within eXist:

java -jar start.jar org.exist.management.client.JMXClient -c -w 2000
September 2009
The eXist Project