ConnectionPool monitoring

You can use the ConnectionPool MXBean for connection pool monitoring in Liberty.

Performance data is made available for each connection pool. Connection pools manage connections from data sources and connection factories.

To enable connection pool monitoring, you must enable the monitor-1.0 feature:
<feature>monitor-1.0</feature>
The ObjectName for identifying each ConnectionPool MXBean is:
WebSphere:type=ConnectionPoolStats,name=<IDENTIFIER_OF_CONNECTION_MANAGER>
The following example shows a connection pool (for a data source or connection factory) that does not have a JNDI name. The data source [default-x] name is considered as the data source object when JNDI is not specified.
WebSphere:type=ConnectionPoolStats,name=transaction/dataSource[default-0]/connectionManager

<transaction enableLoggingForHeuristicReporting="true" transactionLogSize="2048">
	<dataSource transactional="false">
		<jdbcDriver libraryRef="DerbyLib"/>
		<properties.derby.embedded databaseName="<DIR Path>/<DatabaseName>" createDatabase="create"/>
	</dataSource>
</transaction>
Example configurations when a connection manager is provided.
  • When an explicit ID is not specified, an ID is generated based on its parent
    WebSphere:type=ConnectionPoolStats,name=dataSource[MyDataSource]/connectionManager[default-0]
    
    <dataSource id="MyDataSource">
    	<connectionManager maxPoolSize="10"/>
    	<jdbcDriver libraryRef="DB2JCC4LIB"/>
    	<properties.db2.jcc .../>
    </dataSource>
    
  • When an ID is specified, that becomes the identifier
    WebSphere:type=ConnectionPoolStats,name=connectionManager[Pool2]
    
    <dataSource id="DataSource2" jdbcDriverRef="DB2JCCDriver" connectionManagerRef="Pool2">
    	<properties.db2.jcc .../>
    </dataSource>
    <connectionManager id="Pool2" maxPoolSize="20"/> 
  • Obtaining the correct identifier for a type 2 driver connection pool.
    • Ensure that the application that is using the pool makes a call to DB2 so that the pool is initialized.
    • Navigate to the REST interface to determine the proper identifier to use in the configuration. For example:
      host:443/IBMJMXConnectorREST/mbeans

    Specifying the correct identifier for a connection pool for a type 2 driver

    {"objectName":"WebSphere:type=ConnectionPoolStats,name=jdbc/acp01","     
        className":"com.ibm.ws.connectionpool.monitor.ConnectionPoolStats","     
        URL":"/IBMJMXConnectorREST/mbeans/WebSphere%3Aname%3Djdbc%2Facp01%       
        2Ctype%3DConnectionPoolStats"}                               
        

The ConnectionPool MXBean is responsible for reporting ConnectionPool Stats for a single connection manager. The following counter attributes are available for the ConnectionPool MXBean after monitoring is enabled:

CreateCount
The total number of managed connections that have been created since pool creation.
DestroyCount
The total number of managed connections that have been destroyed since pool creation.
ManagedConnectionCount
The total number of managed connections in the free, shared, and unshared pools.
WaitTime
The average waiting time in milliseconds until a connection is granted if a connection is not currently available.
ConnectionHandleCount
The number of connections that are in use. This number might include multiple connections that are shared from a single managed connection.
FreeConnectionCount
The number of managed connections in the free pool.
InUseTime
The average time in milliseconds that a connection is in use.
WaitTimeDetails

Wait time details that include the total number of queued requests, minimum wait time, and maximum wait time.

InUseTimeDetails

In use time details that include the total number of granted connections (excluding the ones that are currently in use), minimum in use time, and maximum in use time.