9 Replies Latest reply on Jul 12, 2016 11:07 AM by Helen Chen

    how to check how many live connections in connection pool

    Helen Chen Novice

      Hi there,

       

      I'm using Wildfly 10.0.0-final on Solaris 10 with standalone mode.  I want to have a way to check how many live connections in the connection pool, is there any way in wildfly (or from wildfly admin console) to see it? Or do I have to use other tools?

       

      Thanks, Helen

        • 2. Re: how to check how many live connections in connection pool
          Helen Chen Novice

          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
            Morty Tenenbaum Newbie

            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
              Helen Chen Novice

              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
                Tomaz Cerar Master

                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
                  Bubul Dey Newbie

                  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
                    Helen Chen Novice

                    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
                      Bubul Dey Newbie

                      Yup Helen,

                       

                      It is possible from management console as well to get the runtime statistics. Please find the screen shot below. WildFly.jpg

                      Regards,

                      Sid

                      • 9. Re: how to check how many live connections in connection pool
                        Helen Chen Novice

                        Hi Sid,

                         

                        I got it. It is from runtime tab. Thanks so much.

                         

                        Helen