[Other doc versions]
It is possible to monitor various statistics using JMX counters within Stash. Below are some examples of some statistics that can be monitored.
|IoPumpThreadPool||Threads that handle external process IO|
|ScheduledThreadPool||Thread pool that takes care of several miscellaneous scheduled tasks|
|EventThreadPool||Threads that dispatch events to @EventListenermethods|
|ActiveCount||Returns the approximate number of threads that are actively executing tasks.|
|MaximumPoolSize||Returns the maximum allowed number of threads.|
|PoolSize||Returns the current number of threads in the pool.|
|QueueLength||The number of tasks awaiting execution by the thread pool.|
|LargestPoolSize||The largest number of threads that have ever been simultaneously in the pool.|
|CompletedTaskCount||The approximate total number of tasks that have completed execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls.|
Stash exposes the JMX attributes from number of third party libraries. Listed below is a sample of the attributes that are particularly interesting from an operations perspective.
Returns total number of connections currently in use by stash
Return the average time it takes for a getConnection request to be services (in ms).
Return the average execution time for prepared statements to execute (in ms).
Get the global number of cached queries successfully retrieved from cache
Get the global number of cached queries *not* found in cache
Global number of cacheable entities/collections successfully retrieved from the cache
Global number of cacheable entities/collections not found in the cache and loaded from the database.
To enable Stash to publish specific statistics using JMX you need to
setenv.shfile to enable Stash to expose JMX Mbeans.
These changes will not take effect until Stash has been restarted.
To modify (or create) the stash-config.properties file
stash-config.properties file, in the
shared folder of your Stash home directory. Take care to use the standard format for Java properties files.
stash-config.propertiesfile is created automatically if you previously performed a database migration.
Add this property to the file.
To set up a JMX password file to secure access to JMX monitoring
Create a file named
This file will contain password information. Ensure the file is only readable by the secure user Stash will run under. However, note that if the Stash user cannot read the file Stash will fail to start.
jmx.access file to include this property and save the file.
If you wish to user a username other than
controlRole you will need to modify the jmxremote.access file that is bundled with stash in the
To modify the
setenv.sh (for Windows
setenv.bat) files to enable JMX monitoring for Stash
bin directory, locate the file
setenv.sh (for Windows
setenv.bat) and change these properties.
To expose JMX MBeans when Stash is run as a Windows service.
Open the command line prompt and enter.
Navigate to the Stash
Run this command.
In the window that appears, click on the Java tab to see the list of current startup options. Under "Java Options:" form, input the value
Ensure the owner of this password file is the secure user Stash will run as. If the Stash user cannot read the file, Stash will fail to start.
Replace the values within the < > characters.
Restart Stash Service.
These steps use JConsole to test that JMX has been configured correctly. JConsole is a utility that ships with the Oracle JDK.
To start the jconsole utility, from a command line prompt enter
Create a new JConsole connection with similar connection settings.
|stash||the hostname of the instance of Stash to monitor|
the JMX port number previously configured.
|username, password||values configured within the JMX password file |
When configured correctly, you will see these properties.
This dashboard was generated using Java Mission Control that ships with the Oracle JDK (since 1.7u40). See the documentation that comes with your JMX client of choice for more information.
You can find information about the options for configuring JMX to use SSL in the setenv files. Comprehensive documentation is available from Oracle.