-
1. Re: how to check how many live connections in connection pool
ctomc Jul 6, 2016 6:29 PM (in response to hchenkwi)what connection pool?
-
2. Re: how to check how many live connections in connection pool
hchenkwi Jul 7, 2016 9:03 AM (in response to ctomc)Sorry I didn't describe clearly.
I created an database datasource like following, then when I use jndi to connect to mysql database, the connection pool should be created by wildfly so everytime program calls getConnection, the connection is returned from pool. This is my understanding.
Is there any way to see how many live connections in the pool? I don't know how to look at jmx through Wildfly. or is there any other way to look at it.
<datasource jta="true" jndi-name="java:/mypool" pool-name="mypool" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://myserver:3306/genericq</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<connection-property name="zeroDateTimeBehavior">
convertToNull
</connection-property>
<driver>mysql</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>uid</user-name>
<password>pwd</password>
</security>
<validation>
<check-valid-connection-sql>select count(*) from dual</check-valid-connection-sql>
<background-validation>true</background-validation>
<background-validation-millis>60000</background-validation-millis>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
<timeout>
<idle-timeout-minutes>1</idle-timeout-minutes>
</timeout>
</datasource>
Thanks, Helen
-
3. Re: how to check how many live connections in connection pool
mortytenenbaum Jul 11, 2016 1:38 PM (in response to hchenkwi)You can use the jboss-cli.bat (or .sh for Linux) tool .
This is in the "bin" folder.
The syntax will be something like
jboss-cli
connect - You may need to enter servername/port/user/password depending on how your server is configured.
Once you are connected, the command to grab the connection information will be something like.
/subsystem=datasources/data-source=mypool/statistics=pool/:read-resource(recursive=false,proxies=false,include-runtime=true,include-defaults=true)
The part which tells you the number of live connections is listed as "Active Count".
-
4. Re: how to check how many live connections in connection pool
hchenkwi Jul 11, 2016 4:57 PM (in response to mortytenenbaum)Hi Morty,
Thanks a lot, I got it.
There is no way from Wildfly admin console to see this value, right? I'm thinking how to make it easier for system admin group to see the value.
Thanks, Helen
-
5. Re: how to check how many live connections in connection pool
ctomc Jul 11, 2016 6:10 PM (in response to hchenkwi)you can see that same in the admin console as well.
just make sure you have statistics enabled for your datasource, by default they are not.
-
6. Re: how to check how many live connections in connection pool
sidde3 Jul 12, 2016 1:55 AM (in response to ctomc)Hi Helen,
If you want to check the live connection is connection pool, please use jboss-cli else in admin console run time you can check.
Use below command and check the Active count
/subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(include-runtime=true)
Note: This example for the datasource "ExampleDS"
Regards,
Siddhartha
-
7. Re: how to check how many live connections in connection pool
hchenkwi Jul 12, 2016 9:51 AM (in response to ctomc)when you say admin console, is it Wildfly administration console?
from command line I can get "activeCount", but from Wildfly administration console, going through configuration/subsystem/datasources/Non-XA/datasource name, from tab "pool", I can only see "min pool size", "max pool size", not sure which one means "activeCount".
I just feel GUI is easier for system admin to look for information. u
Thanks, Helen
-
8. Re: how to check how many live connections in connection pool
sidde3 Jul 12, 2016 10:52 AM (in response to hchenkwi) -
9. Re: how to check how many live connections in connection pool
hchenkwi Jul 12, 2016 11:07 AM (in response to sidde3)Hi Sid,
I got it. It is from runtime tab. Thanks so much.
Helen