ConnectionPool 监视
可以使用 ConnectionPool MXBean 对 Liberty 概要文件进行 ConnectionPool 监视。
系统为每个连接池提供性能数据。连接池管理来自数据源和连接工厂的连接。
每个连接管理器具有关联 ConnectionPool MXBean,每个连接管理器有一个 MXBean。
用于标识每个 ConnectionPool MXBean 的 ObjectName 为:
WebSphere:type=ConnectionPool,name=<IDENTIFIER_OF_CONNECTION_MANAGER>
以下示例显示没有 JNDI 名称的连接池(对于数据源或连接工厂)。如果未指定 JNDI,那么数据源 [default-x]
名称被视为数据源对象。WebSphere:type=ConnectionPool,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>
提供连接管理器后的示例配置
- 如果未指定显式标识,那么系统根据其父代生成标识
WebSphere:type=ConnectionPool,name=dataSource[MyDataSource]/connectionManager[default-0] <dataSource id="MyDataSource"> <connectionManager maxPoolSize="10"/> <jdbcDriver libraryRef="DB2JCC4LIB"/> <properties.db2.jcc .../> </dataSource>
- 如果指定了标识,那么该标识变为标识符
WebSphere:type=ConnectionPool,name=connectionManager[Pool2] <dataSource id="DataSource2" jdbcDriverRef="DB2JCCDriver" connectionManagerRef="Pool2"> <properties.db2.jcc .../> </dataSource> <connectionManager id="Pool2" maxPoolSize="20"/>
ConnectionPool MXBean 负责报告单个连接管理器的 ConnectionPool 统计信息。启用监视之后,以下计数器属性可用于 ConnectionPool MXBean:
- CreateCount
- 创建的连接总数。
- DestroyCount
- 损坏的连接总数。
- ManagedConnectionCount
- 正在使用的 ManagedConnection 对象数。
- WaitTime
- 到授权连接为止的平均等待时间(以毫秒计)。
- ConnectionHandleCount
- 正在使用的 Connection 对象数。
- FreeConnectionCount
- 池中的空闲连接数。