4 Replies Latest reply on Jan 4, 2013 7:32 PM by sfcoy

    Jboss connection pool has high TotalBlockingTime

    eric2

      I have a lot of blocked threads all on this stacktrace:

       

      Stack Trace:

      org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getConnectionProperties(BaseWrapperManagedConnectionFactory.java:1005)
      org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:490)
      org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:282)
      org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
      org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
      org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
      org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:302)
      org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
      org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

       

      Not all of the connections are handed out, yet I see a lot of wait time trying to get a connection to the db.

      statistics.pool.ActiveCount60
      statistics.pool.AvailableCount46
      statistics.pool.AverageBlockingTime33731
      statistics.pool.AverageCreationTime756
      statistics.pool.CreatedCount79
      statistics.pool.DestroyedCount19
      statistics.pool.MaxCreationTime2310
      statistics.pool.MaxUsedCount60
      statistics.pool.MaxWaitTime1976
      statistics.pool.TimedOut19
      statistics.pool.TotalBlockingTime2664779
      statistics.pool.TotalCreationTime59753

       

      standalone.xml

       

      <datasources>

                      <datasource jta="false" jndi-name="java:jboss/datasource/oracle" pool-name="oracle" enabled="true" use-ccm="false">

                          <connection-url>jdbc:oracle:thin:@//produt-scan.ora.ut.us.attask.com/cl2load</connection-url>

                          <driver-class>oracle.jdbc.OracleDriver</driver-class>

                          <driver>oracle</driver>

                          <pool>

                              <min-pool-size>20</min-pool-size>

                              <max-pool-size>60</max-pool-size>

                              <prefill>true</prefill>

                          </pool>

                          <security>

                              <security-domain>encryptedoracle-ds</security-domain>

                          </security>

                          <validation>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>false</background-validation>

                          </validation>

                          <statement>

                              <prepared-statement-cache-size>10</prepared-statement-cache-size>

                              <share-prepared-statements>true</share-prepared-statements>

                          </statement>

                      </datasource>

        • 1. Re: Jboss connection pool has high TotalBlockingTime
          sfcoy

          This suggests that you have a lot of slow and possibly inefficient queries being executed.

           

          Is it possible that you're a victim of the N + 1 SELECT problem?

          • 2. Re: Jboss connection pool has high TotalBlockingTime
            eric2

            OK, so TotalBlockingTime is the time that the connection is out of the pool? Does that mean the average blocking time is the time that it is being leased to thread?

             

            I'm doing some load testing so I"m really hitting the application hard. What worries me is that I see a lot of blocked threads and they are always blocking on that stacktrace. What I don't understand is why does it block handing out connections?

            • 3. Re: Jboss connection pool has high TotalBlockingTime
              sfcoy

              Your max-pool-size is 60. If your application requests more than 60 connections at any one time, the calling thread will block until one becomes available (on a FIFO basis).

               

              ie. if your load test has 100 users, all performing the same operation (which could be slow for the above mentioned reason), then you will experience blocking. The average blocking time of 33731 (33.7 seconds) suggests that this is what is happening.

              • 4. Re: Jboss connection pool has high TotalBlockingTime
                sfcoy

                And to answer your question:

                 

                The blocking time is the length of time that a thread has to wait before it is given a connection from the pool.