问题描述
我正在处理一个项目,在该项目中,我试图获取我的数据源连接池的运行时统计信息,该数据池已使用Wildfly-9放入/deployment文件夹中.我搜索了它,发现配置文件存在于/standalone文件夹中,名为standalone.xml文件,它使用以下代码为我提供了数据源连接池的统计信息:
I'm working on the project where I'm trying to get the runtime statistics of my datasource connection pool which I placed into /deployment folder using Wildfly-9.I searched for it and I found the configuration file which exist inside /standalone folder named as standalone.xml file giving me the statistics of datasource connection poool by using below code :
<datasource jta="true" jndi-name="java:jboss/datasources/DemoDS" pool-name="DemoDS" enabled="true" use-ccm="true" statistics-enabled="true">
<connection-url>jdbc:mysql://localhost:3306/demo?zeroDateTimeBehavior=convertToNull</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>50</max-pool-size>
</pool>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
点击此网址,我得到了:
Hit this url I got this:
我得到以下json字符串:您将获得以下json字符串:
I get the following json string:You get the following json string:
{
"ActiveCount":4,
"AvailableCount":48,
"AverageBlockingTime":0,
"AverageCreationTime":21,
"AverageGetTime":17,
"AveragePoolTime":195196,
"AverageUsageTime":43,
"BlockingFailureCount":0,
"CreatedCount":4,
"DestroyedCount":0,
"IdleCount":2,
"InUseCount":2,
"MaxCreationTime":47,
"MaxGetTime":47,
"MaxPoolTime":386185,
"MaxUsageTime":134,
"MaxUsedCount":4,
"MaxWaitCount":0,
"MaxWaitTime":0,
"TimedOut":0,
"TotalBlockingTime":0,
"TotalCreationTime":87,
"TotalGetTime":88,
"TotalPoolTime":780787,
"TotalUsageTime":217,
"WaitCount":0,
"XACommitAverageTime":0,
"XACommitCount":0,
"XACommitMaxTime":0,
"XACommitTotalTime":0,
"XAEndAverageTime":0,
"XAEndCount":0,
"XAEndMaxTime":0,
"XAEndTotalTime":0,
"XAForgetAverageTime":0,
"XAForgetCount":0,
"XAForgetMaxTime":0,
"XAForgetTotalTime":0,
"XAPrepareAverageTime":0,
"XAPrepareCount":0,
"XAPrepareMaxTime":0,
"XAPrepareTotalTime":0,
"XARecoverAverageTime":0,
"XARecoverCount":0,
"XARecoverMaxTime":0,
"XARecoverTotalTime":0,
"XARollbackAverageTime":0,
"XARollbackCount":0,
"XARollbackMaxTime":0,
"XARollbackTotalTime":0,
"XAStartAverageTime":0,
"XAStartCount":0,
"XAStartMaxTime":0,
"XAStartTotalTime":0,
"statistics-enabled":true
}
由于我有许多数据源文件,因此无法放入单独的standalone.xml文件中.因此,谁知道我将如何获取放置在/deployment文件夹中的数据源连接池的运行时统计信息?
Since I have many datasource file I cannot place into individual standalone.xml file.So anyone knows how I will get the runtime statistics of my datasource connection pool which I placed into /deployment folder?
推荐答案
从Wildfly CLI:
From Wildfly CLI:
检查是否为数据源启用了统计信息
/subsystem=datasources/data-source=(your datasourcename):read-attribute(name=statistics-enabled)
启用统计信息:需要随后重新启动Wildfly服务
/subsystem=datasources/data-source=(your datasource):write-attribute(name=statistics-enabled, value=true)
重新启动后,请启动CLI并再次运行check命令.
After restart start CLI and run the check command again.
这篇关于监视Wildfly9上的数据源连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!