簡體   English   中英

監視Wildfly9上的數據源連接池

[英]Monitoring datasource connection pool on Wildfly9

我正在處理這個項目,我正在嘗試獲取我使用Wildfly-9放入/ deployment文件夾的數據源連接池的運行時統計信息。 我搜索了它,我找到了名為standalone.xml文件的/ standalone文件夾中的配置文件,通過使用下面的代碼給出了數據源連接poool的統計信息:

<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>

點擊這個網址我得到了這個:

HTTP://本地主機:9990 /管理/子系統/數據源/數據源/ DemoDS /統計/池包括運行時= TRUE

我得到以下json字符串:你得到以下json字符串:

{
   "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文件夾的數據源連接池的運行時統計信息?

來自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命令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM