Connection Pool Monitoring

33,514

Solution 1

This might not be what you want. But what are you using for the pool anyway? If you haven't decided, check out C3PO, it provides JMX exposed attributes for monitoring

Solution 2

For a typical server side java application, one of the most preferred way of monitoring is through the JMX. Most of the application (including connection pools) offer a default JMX bean (called MBeans or managed beans) which can be used for monitoring. A connection pool (e.g. C3P0) creates an MBean binds it with the underlying available JMX server (which is there in almost all of the application server including tomcat, JBoss)

This MBean will hold all the information about the connection pool. You have mentioned you are using JBoss server. On the web admin console offered by Jboss, there should be a provision to view all the MBeans (including the MBean of deployed Connection pool).

Another way to monitor is though JConsole utility which comes with Java. The same JConsole can be used to monitor the JBoss AS as well.

Solution 3

FlexyPool is a data source proxy offering better monitoring and failover for almost all known connection pools:

  • Apache DBCP
  • Apache DBCP2
  • C3P0
  • BoneCP
  • HikariCP
  • Tomcat CP
  • Vibur DBCP
  • Bitronix Transaction Manager
  • Atomikos TransactionsEssentials

It allows you monitor the following metrics:

  • concurrent connections histogram
  • concurrent connection requests histogram
  • data source connection acquiring time histogram
  • connection lease time histogram
  • maximum pool size histogram
  • total connection acquiring time histogram
  • overflow pool size histogram
  • retries attempts histogram

This way you can adjust the pool size so that it can accommodate as many application nodes as possible while protecting you from some unexpected traffic spikes.

Solution 4

I found that when using JConsole as suggested in other answers to connect to JBoss (5.2) via JMX the MBeans for the Connection Pooling were not visible.

Instead I used the built in JMXConsole typically available at: http://localhost:8080/jmx-console - you may have to change the hostname and port for your deployment.

If this is running you will see a username and password prompt.
The default username/password is: admin/admin
I found the first time I tried this, nothing happened, I had to update the file: server/default/conf/props/jmx-console-users.properties and uncomment the 2nd line:

# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin

Once this was done I could login. At that point in the ObjectName Filter I entered: jboss.jca:* I then selected the appropriate connection pool link for example: name=DefaultDS,service=ManagedConnectionPool which shows all the connection pool information, e.g. AvailableConnectionCount, InUseConnectionCount etc.

Share:
33,514
IMJS
Author by

IMJS

Updated on January 06, 2020

Comments

  • IMJS
    IMJS over 4 years

    I need an insight on monitoring connection pool in my web application.
    The technical specifications about the application is mentioned below:

    1. Application Server - JBoss Application Server
    2. Database - Oracle 10g
    3. Back-end - Hibernate

    I need to know that what are the different ways of monitoring connection pool and how we can do that. Whether through Hibernate or through JBoss or anyother way? Please suggest me the right way to do that.