Explanation of the JCA JDBC pool statistics for JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
- Java Connector Architecture (JCA)
- 1.7
- 1.6
- IronJacamar 1
Issue
- What are the meanings of the data-source statistics reported by the CLI statistics read command?
- How are datasource metrics calculated?
[standalone@localhost:9990 /] /subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(include-runtime=true)
{
"outcome" => "success",
"result" => {
"ActiveCount" => 1,
"AvailableCount" => 20,
"AverageBlockingTime" => 0L,
"AverageCreationTime" => 110L,
"AverageGetTime" => 114L,
"AveragePoolTime" => 0L,
"AverageUsageTime" => 0L,
"BlockingFailureCount" => 0,
"CreatedCount" => 1,
"DestroyedCount" => 0,
"IdleCount" => 1,
"InUseCount" => 0,
"MaxCreationTime" => 110L,
"MaxGetTime" => 114L,
"MaxPoolTime" => 0L,
"MaxUsageTime" => 0L,
"MaxUsedCount" => 1,
"MaxWaitCount" => 0,
"MaxWaitTime" => 0L,
"TimedOut" => 0,
"TotalBlockingTime" => 0L,
"TotalCreationTime" => 110L,
"TotalGetTime" => 114L,
"TotalPoolTime" => 0L,
"TotalUsageTime" => 0L,
"WaitCount" => 0,
"XACommitAverageTime" => 0L,
"XACommitCount" => 0L,
"XACommitMaxTime" => 0L,
"XACommitTotalTime" => 0L,
"XAEndAverageTime" => 0L,
"XAEndCount" => 0L,
"XAEndMaxTime" => 0L,
"XAEndTotalTime" => 0L,
"XAForgetAverageTime" => 0L,
"XAForgetCount" => 0L,
"XAForgetMaxTime" => 0L,
"XAForgetTotalTime" => 0L,
"XAPrepareAverageTime" => 0L,
"XAPrepareCount" => 0L,
"XAPrepareMaxTime" => 0L,
"XAPrepareTotalTime" => 0L,
"XARecoverAverageTime" => 0L,
"XARecoverCount" => 0L,
"XARecoverMaxTime" => 0L,
"XARecoverTotalTime" => 0L,
"XARollbackAverageTime" => 0L,
"XARollbackCount" => 0L,
"XARollbackMaxTime" => 0L,
"XARollbackTotalTime" => 0L,
"XAStartAverageTime" => 0L,
"XAStartCount" => 0L,
"XAStartMaxTime" => 0L,
"XAStartTotalTime" => 0L,
"statistics-enabled" => true
}
}
Note that available statistics will vary with JBoss EAP version.
Resolution
Description of individual/specific pool statistic properties may be found in the release version specific configuration guide for JBoss EAP. The documents for the most recent JBoss EAP 6 and 7 releases are:
There are two types of statistics:
- Simple counters (typically suffixed with
Count) that reflect the current state or history of the connection pool. Among the commonly evaluated counters (e.g. when analyzing health/performance of the pool) are the following1:InUseCount- The number of physical connections that are reserved by application components which have executed agetConnection()request but not yet returned the connection to the pool by callingclose().- These connections may or may not be associated with in-progress SQL command execution but the connections are in a reserved state (owned by the application) and are not available to be returned by
getConnection()requests. This count may include connections that have been leaked by application code which fails to callConnection.close()(i.e. to release the connection back to the pool) after use of the connection. - A value for this counter which approaches the configured
max-pool-sizemay represent an undersized pool (too small to satisfy concurrent demand during peak load) or incidents of connection leaks.
- These connections may or may not be associated with in-progress SQL command execution but the connections are in a reserved state (owned by the application) and are not available to be returned by
IdleCount- The number of existing connections that are in the idle/free pool (not currently reserved by application components)- These connections are not participants in active transactions nor in-progress SQL command executions.
MaxUsedCount- The maximum number of connections used at one time - a "high water" mark- A high value for this counter may reflect a present or past instant (or timeframe) during which concurrent demand for connections was high due to load or performance issues. When
MaxUsedCountis observed to be close to the configuredmax-pool-size, concurrent load analysis may be warranted or an increase inmax-pool-sizemay be appropriate. Note that this count will differ fromInUseCountwhen statistics are taken if the number of in-use connections has dropped since theMaxUsedCountwas last reached.
- A high value for this counter may reflect a present or past instant (or timeframe) during which concurrent demand for connections was high due to load or performance issues. When
ActiveCount- The number of open/existing connections - whether in a reserved/in-use state or an unreserved/idle state- A high value for this counter may correlate to a high number of open connections reported by database server tooling.
AvailableCount- The number of connections that can currently be handed out to satisfygetConnection()requests- These connections may not yet exist but could be created, if needed, within the limits of the configured
max-pool-sizeso the value is equal tomax-pool-size-InUseCount.
- These connections may not yet exist but could be created, if needed, within the limits of the configured
DestroyedCount- The number of connections destroyed- A high number of destroyed connections may suggest a high number of external connection failures (e.g. network or database server initiated connection closure) or may coincide with a high number of
TimedOutconnections.
- A high number of destroyed connections may suggest a high number of external connection failures (e.g. network or database server initiated connection closure) or may coincide with a high number of
- TimedOut - The number of connections destroyed by the idle remover thread (as configured by idle-timeout-minutes)
- Time-based statistics (suffixed with
Time) that reflect average, maximum or total millisecond times for important connection or pool events among which are the following2:*UsageTime- Time connections have spent in a reserved state (owned by application components) between the initialgetConnection()request and the timeConnection.close()is called by the application to release the connection back to the pool- A high
AverageUsageTimeindicates long periods during which connections were held by application components and may suggest performance problems that relate either to application activity (e.g. expensive calculations, long waits on external resource while holding a connection, etc.) or long running SQL commands.
- A high
*CreationTime- Time spent creating new connections to the datasource.- A high
AverageCreationTimemay indicate potential problems with the network or database (i.e. the JDBC driver is encountering long waits during negotiation with the database server while attempting to create new connections).
- A high
*BlockingTime- Time spent waiting for a connection to be supplied by the pool.- A high
AverageBlockingTime3 may indicate an undersized pool (too small to satisfy concurrent demand during peak load) or a general performance problem where application components fail to complete operations in a timely manner and return the connections used.
- A high
Note that current releases include statistics for XA operations (such as XA commit and prepare). The counter and time-based statistics may be useful for XA datasource pool evaluation/monitoring.
Individual values above can be explicitly retrieved using CLI commands similar to the below:
[standalone@localhost:9999 /] /subsystem=datasources/data-source=ExampleDS/statistics=pool:read-attribute(name=CreatedCount)
See Also
Consult the version-specific product documentation for additional properties
2: Consult the version-specific product documentation for additional properties
3: A change related to Content from issues.jboss.org is not included.JBJCA-961 was introduced in the JBoss EAP 6.1 GA release at which point the calculation used became totalBlockingTime / Invocations whereas previously it was totalBlockingTime / createdCount.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.