jboss datasource statistics JMX监控 - 信息不一致

时间:2011-05-05 08:56:40

标签: sql jboss datasource jmx

我在jboss 4.2.3上的* -ds.xml中定义了两个数据源(redhat 4.3) 两个数据源都是相同的。只有jndi-name不同 每个定义min = max = 10

<xa-datasource>
 <jndi-name>com.trax.hibernate.DataSource</jndi-name>
 <track-connection-by-tx>true</track-connection-by-tx>
 <isSameRM-override-value>false</isSameRM-override-value>
 <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
 <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:orcl10</xa-datasource-property>
 <xa-datasource-property name="User"> xxxx </xa-datasource-property>
 <xa-datasource-property name="Password"> xxxx </xa-datasource-property>
 <min-pool-size>10</min-pool-size>
 <max-pool-size>10</max-pool-size>
 <prefill>true</prefill>
 <blocking-timeout-millis>60000</blocking-timeout-millis>
 <ih3e-timeout-minutes>15</ih3e-timeout-minutes>
 <valid-connection-checker-class-name> org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker </valid-connection-checker-class-name>
 <check-valid-connection-sql>select 1 from gtw_cust</check-valid-connection-sql>
 <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
 <no-tx-separate-pools/>
</xa-datasource>

<xa-datasource>
 <jndi-name>AuditTrail.DataSource</jndi-name>
 <track-connection-by-tx>true</track-connection-by-tx>
 <isSameRM-override-value>false</isSameRM-override-value>
 <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
 <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:orcl10</xa-datasource-property>
 <xa-datasource-property name="User">xxxx</xa-datasource-property>
 <xa-datasource-property name="Password"> xxxx </xa-datasource-property>
 <min-pool-size>10</min-pool-size>
 <max-pool-size>10</max-pool-size>
 <prefill>true</prefill>
 <blocking-timeout-millis>60000</blocking-timeout-millis>
 <ih3e-timeout-minutes>15</ih3e-timeout-minutes>
 <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
 <check-valid-connection-sql>select 1 from gtw_cust</check-valid-connection-sql>
 <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
 <no-tx-separate-pools/>
</xa-datasource>

问题: 在jmx-console上,name = com.trax.hibernate.DataSource,service = ManagedConnectionPool,信息显示20个连接,而不是预期的10个。

我希望创建的连接的最大值为10(MaxSize)。 似乎实际连接的数量是双MaxSize,连接被创建和销毁(40个创建,20个被破坏)

我做错了什么?你怎么解释这个?

com.trax.hibernate.DataSource:
AvailableConnectionCount    20
ConnectionCount           20
MinSize                      10
MaxSize                      10
MaxConnectionsInUseCount    11
InUseConnectionCount              0
ConnectionCreatedCount  40
ConnectionDestroyedCount    20

AuditTrail.DataSource:
AvailableConnectionCount    10
ConnectionCount           10
MinSize                      10
MaxSize                      10
MaxConnectionsInUseCount    8
InUseConnectionCount              0
ConnectionCreatedCount  20
ConnectionDestroyedCount    10

1 个答案:

答案 0 :(得分:5)

这是因为属性<no-tx-separate-pools/>。请参阅“JBoss服务器配置指南”中的XA数据源文档:

  

<no-tx-separate-pools>

     

单独汇总交易和非交易连接

     

警告

     

使用此选项将导致总池大小为max-pool-size的两倍,因为将创建两个实际池。

http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.3/html-single/Server_Configuration_Guide/index.html#id2947572