Tuesday 24 October 2017

Monitor DataSource connection pool statistics in JBoss EAP

In this post we focus on DataSource connection pool statistics for your application with
The Command Line Interface (CLI).

In EAP 6.3 and later, DataSource statistics need to be explicitly enabled as they are disabled by default to minimize performance impact.

By using below command you can enable DataSource connection pool statistics. after that restart the servers to take effect.

Syntax: /profile=<Profilename>/subsystem=datasources/data-source=< data-source Name>:write-attribute (name=statistics-enabled,value=true)

[domain@192.168.1.12:9999 /] /profile=better/subsystem=datasources/data-source=BetterDS:write-attribute(name=statistics-enabled, value=true)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}


Then check the DataSource statistics:

To view the statistics via management console, migrate to the Runtime Tab. Go to Subsystems --> Datasources. Click on the data-source whose statistics you need to view.

CLI example in Domain mode:

Core Statistics :

Syntax: host=<HC name>/server=<AS name>/subsystem=datasources/data-data=<data source name>/statistics=pool:read-resource(recursive=true, include-runtime=true)

[domain@192.168.1.12:9999 /]/host=slave01/server=better-as1/subsystem=datasources/data-source=BetterDS/statistics=pool:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "ActiveCount" => "1",
        "AvailableCount" => "20",
        "AverageBlockingTime" => "0",
        "AverageCreationTime" => "2583",
        "CreatedCount" => "2",
        "DestroyedCount" => "1",
        "InUseCount" => "0",
        "MaxCreationTime" => "5092",
        "MaxUsedCount" => "1",
        "MaxWaitCount" => "0",
        "MaxWaitTime" => "0",
        "TimedOut" => "1",
        "TotalBlockingTime" => "0",
        "TotalCreationTime" => "5166",
        "statistics-enabled" => true
    }
}

 The following table contains a list of the supported datasource core statistics:

Name
Description
ActiveCount
The number of active connections. Each of the connections is either in use by an application or available in the pool
AvailableCount
The number of available connections in the pool.
AverageBlockingTime
The average time spent blocking on obtaining an exclusive lock on the pool. The value is in milliseconds.
AverageCreationTime
The average time spent creating a connection. The value is in milliseconds.
CreatedCount
The number of connections created.
DestroyedCount
The number of connections destroyed.
InUseCount
The number of connections currently in use.
MaxCreationTime
The maximum time it took to create a connection. The value is in milliseconds.
MaxUsedCount
The maximum number of connections used.
MaxWaitCount
The maximum number of requests waiting for a connection at the same time.
MaxWaitTime
The maximum time spent waiting for an exclusive lock on the pool.
TimedOut
The number of timed out connections.
TotalBlockingTime
The total time spent waiting for an exclusive lock on the pool. The value is in milliseconds.
TotalCreationTime
The total time spent creating connections. The value is in milliseconds.
WaitCount
The number of requests that had to wait for a connection.

JDBC Statistics

Syntax: host=<HC name>/server=<AS name>/subsystem=datasources/data-data=<data source name>/statistics=jdbc:read-resource(recursive=true, include-runtime=true)

[domain@192.168.1.12:9999 /]/host=slave01/server=better-as1/subsystem=datasources/data-source=BetterDS/statistics=jdbc:read-resource(recursive=true, include-runtime=true)
{
    "outcome" => "success",
    "result" => {
        "PreparedStatementCacheAccessCount" => "0",
        "PreparedStatementCacheAddCount" => "0",
        "PreparedStatementCacheCurrentSize" => "0",
        "PreparedStatementCacheDeleteCount" => "0",
        "PreparedStatementCacheHitCount" => "0",
        "PreparedStatementCacheMissCount" => "0",
        "statistics-enabled" => true
    }

}



The following table contains a list of the supported datasource JDBC statistics:


Name
Description
PreparedStatementCacheAccessCount
The number of times that the statement cache was accessed.
PreparedStatementCacheAddCount
The number of statements added to the statement cache.
PreparedStatementCacheCurrentSize
The number of prepared and callable statements currently cached in the statement cache.
PreparedStatementCacheDeleteCount
The number of statements discarded from the cache.
PreparedStatementCacheHitCount
The number of times that statements from the cache were used.
PreparedStatementCacheMissCount
The number of times that a statement request could not be satisfied with a statement from the cache.



please subscribe my blog  and provide the feedback on this article/blog to improve the articles.

No comments: