Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-9067

Add a 'Waiting Queue Length' metric to datasource connection pool MBean

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Obsolete
    • Icon: Major Major
    • TBD EAP 5
    • EAP_EWP 5.1.2
    • JMX
    • None
    • JBoss Enterprise Application Platform 5.1.2

    • NEW

      The waiting thread pool count is a metric available on connection pools in WebSphere that lets you see a 'backlog' of threads waiting to acquire a connection from the pool. We should add this, in addition to 'connection count' and 'in use count' on JBossManagedConnectionPool, that lets us see which connection pools are causing the backlog when 2 or more connections pools are at their max.

      It is not so difficult to add such a metric. JBoss connection pool is using java.util.concurrent.Semaphore[1] in [2]. So using java.util.concurrent.Semaphore#getQueueLength can be got equivalent metric.

      For instance,

      • Add the following method to [2]:

      public int getWaitingQueueLength()

      { return permits.getQueueLength(); }
      • Add the following one line to the listStatistics() in [3]:

      public JBossStatistics listStatistics()
      {
      final ManagedConnectionPoolStatistics subPoolStats = new JBossManagedConnectionPoolStatistics(subPools.size());

      subPoolStats.setBlockingTimeout(poolParams.blockingTimeout);
      subPoolStats.setIdleTimeout(poolParams.idleTimeout);
      subPoolStats.setMax(poolParams.maxSize);
      subPoolStats.setMin(poolParams.minSize);
      subPoolStats.setPrefill(poolParams.prefill);
      subPoolStats.setNoTxnSeperatePool(noTxSeparatePools);

      for(Iterator iter = subPools.values().iterator(); iter.hasNext()

      { JBossSubPoolStatistics stat = new JBossSubPoolStatistics(); SubPoolContext subContext = (SubPoolContext)iter.next(); final InternalManagedConnectionPool internalPool = subContext.getSubPool(); stat.setAvailableConnections(internalPool.getAvailableConnections()); stat.setConnectionsDestroyed(internalPool.getConnectionDestroyedCount()); stat.setConnectionsInUse(internalPool.getConnectionInUseCount()); stat.setMaxConnectionsInUse(internalPool.getMaxConnectionsInUseCount()); stat.setTotalBlockTime(internalPool.getTotalBlockTime()); stat.setAverageBlockTime(internalPool.getAverageBlockTime()); stat.setMaxWaitTime(internalPool.getMaxWaitTime()); stat.setTotalTimedOut(internalPool.getTimedOut()); stat.setWaitingQueueuLength(internalPool.getWaitingQueueLength()); // add this one subPoolStats.addSubPool(stat); }

      return (JBossStatistics)subPoolStats;
      }

      • Add the following codes to [4]:

      /** The waitingQueueuLength */
      private int waitingQueueuLength;

      /**

      • Get the waitingQueueuLength.
      • @return the waitingQueueuLength.
        */
        public int getWaitingQueueuLength() { return waitingQueueuLength; }

      /**

      • Set the waitingQueueuLength.
      • @param waitingQueueuLength The waitingQueueuLength to set.
        */
        public void setWaitingQueueuLength(int waitingQueueuLength) { this.waitingQueueuLength = waitingQueueuLength; }

      [1] http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Semaphore.html#getQueueLength()
      [2] http://anonsvn.jboss.org/repos/jbossas/branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
      [3] http://anonsvn.jboss.org/repos/jbossas/branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
      [4] http://anonsvn.jboss.org/repos/jbossas/branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/statistic/pool/JBossSubPoolStatistics.java

              navssurtani Navin Surtani (Inactive)
              rhn-support-jshepher Jason Shepherd
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: