Live Monitoring Using the JMX Interface
With the JMX interface (introduced in Confluence 2.8), you can monitor the status of your Confluence instance in real time. This will provide you with useful data such as the resource usage of your instance and its database latency, allowing you to diagnose problems or performance issues. To read the JMX data, you will need to use a JMX client.
Disable JMX
If you experience any problems during Confluence startup that are related to JMX, it is possible to disable the JMX registration process. Please place jmxContext.xml in your <confluence-install>/confluence/WEB-INF/classes
folder to do so.
What is JMX?
JMX (Java Management eXtensions) is a technology for monitoring and managing Java applications. JMX uses objects called MBeans (Managed Beans) to expose data and resources from your application.
1. Enabling JMX Remote with Tomcat
By default, Confluence uses the Apache Tomcat web server. To use JMX, you must enable it on your Tomcat server, by carrying out the steps under the Apache Tomcat documentation, entitled Enabling JMX Remote. With those steps completed, restart your Tomcat server.
For the stand-alone, add the startup parameter -Dcom.sun.management.jmxremote to setenv.sh or setenv.bat. See instructions for Increasing JIRA application memory - enter it in the same place as PermGen Memory.
2. Selecting your JMX Client
You need to use a JMX client in order to view the JMX output from Confluence. JConsole is a readily available JMX client that is included with the supported Java Developer Kit (version 5 onwards). The full name is the 'Java Monitoring and Management Console', but we will refer to it as JConsole for the purposes of this document.
3. Adding the JMX Client to your Path
You must add the location of the JConsole binary file to your path environment variable. As JConsole resides in the 'bin' (binaries) folder under your Java directory, the path should resemble something like this:
JDK_HOME/bin/
In this example, replace 'JDK_HOME' with the full system path to your Java directory.
4. Configuring JConsole
To configure JConsole:
- Run the JConsole application.
You will be prompted to create a new connection. Choose remote process and enter the hostname of your Confluence instance and a port of your choosing.
To connect easily, add the startup parameters to setenv.bat or setenv.sh:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8086 -Dcom.sun.management.jmxremote.authenticate=false
Port 8086 is unlikely to be used. Then, connect remotely using port 8086.JConsole, or any JMX client, will not see applications which are not owned by the same user. For example under Windows, if an application is started as a service, it is the System User which owns the process, and not the Current User.
- Click Connect.
Note: Other JMX clients besides JConsole can read JMX information from Confluence.
What can I monitor with JMX?
The JMX interface allows you to see live internal information from your Confluence instance, via the following MBeans:
IndexingStatistics
This MBean shows information related to search indexing.
Property name | Function | Values |
---|---|---|
Flushing | Shows state of cache (i.e. flushing, or not). | True/False |
LastElapsedMilliseconds | Time taken during last indexing. | Milliseconds |
LastElapsedReindexing | Time taken during last re-indexing. | Milliseconds |
TaskQueueLength | Shows number of tasks in the queue. | Integer |
SystemInformation
This MBean shows information related to database latency. It also contains most of the information presented on the System Information page.
Property name | Function | Values |
---|---|---|
DatabaseExampleLatency | Shows the latency of an example query performed against the database. | Milliseconds |
RequestMetrics
This MBean shows information related to system load and error pages served.
Property name | Function | Values |
---|---|---|
AverageExecutionTimeForLastTenRequests | Average execution time for the last ten requests. | Milliseconds |
CurrentNumberOfRequestsBeingServed | Number of requests being served at this instant. | Integer |
ErrorCount | Number of times the Confluence error page was served. | Integer |
NumberOfRequestsInLastTenSeconds | Obviously, the Number Of Requests In the Last Ten Seconds. | Integer |
MailServer-SMTPServer
This MBean shows information related to email dispatch attempts and failures. There will be an MBean for every SMTP Mailserver that has been configured in the Confluence instance.
Property name | Function | Values |
---|---|---|
EmailsAttempted | The number of email messages Confluence has tried to send. | Integer |
EmailsSent | The number of email messages sent successfully. | Integer |
MailTaskQueue
This MBean shows information related to the email workload.
Property name | Function | Values |
---|---|---|
ErrorQueueSize | Number of errors in the queue. | Integer |
Flushing | Shows state (i.e. flushing, or not) | True/False |
FlushStarted | Time that operation began. | Time |
RetryCount | The number of retries that were performed. | Integer |
TaskSize | Number of email messages queued for dispatch. | Integer |
SchedulingStatistics
This MBean shows information related to current jobs, scheduled tasks and the time that they were last run.
High CPU consuming threads
For Java 1.6, add the Top Threads Plugin to monitor whether CPU is spiking. Download it to a directory and run JConsole like this:
JConsole -pluginpath /pathto/topthreads.jar
This works only with JDK 1.6, but that can be on the remote machine if the server is running a lower version.
Please note, adding live monitoring to a production instance may itself have an impact on performance.