This topic applies to WebSphere Application Server Liberty V8.5.5.9 and earlier. For the latest Liberty topics, see the WebSphere Application Server Liberty documentation.
ConnectionPool monitoring
You can use the ConnectionPool MXBean for ConnectionPool monitoring of Liberty.
Performance data is made available for each ConnectionPool. Connection pools manage connections from data sources and connection factories.
Each connection manager has a ConnectionPool MXBean associated with it, and there is one MXBean for every connection manager.
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 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 connections created.
- DestroyCount
- The total number of connections destroyed.
- ManagedConnectionCount
- The number of ManagedConnection objects that are in use.
- WaitTime
- The average waiting time in milliseconds until a connection is granted.
- ConnectionHandleCount
- The number of Connection objects that are in use.
- FreeConnectionCount
- The number of free connections in the pool.