commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Halstead <>
Subject [DBCP] Proposal for additional metrics in DBCP and Pool - long
Date Sat, 05 Apr 2003 03:36:34 GMT
I would like to be able to collect metrics from DataSource pools used in
Tomcat via JMX, and I think I have a reasonably good idea of how to do
it but I want to get feedback on the idea first.

The first step would be to add some additional metrics gathering in
o.a.c.pool.  The o.a.c.pool.impl.*Pool classes already expose numIdle
and numActive, and I would propose three additional items:

peakActive - the peak number of objects borrowed from the pool. Made
available through getPeakActive().

totalBorrowed - a counter for how many objects have been borrowed over
the life of the pool. Made available through getTotalBorrowed().

totalReturned - a counter for how many objects have been returned over
the life of the pool. Made available through getTotalReturned().

Once these values and accessor methods are added to the various *Pool
classes, wrapper methods can be added to BasicDataSource to retrieve the
underlying values.

Thats the easy part...

My next concern is how best to make these values available via JMX. 
Would it be a good idea to create a new DataSource class in o.a.c.dbcp,
say InstrumentedBasicDataSource, that implemented the appropriate MBean
interface?  I'm not sure that implementing an MBean interface in
BasicDataSource would be the right thing to do - there is no guarantee
that a JMX server instance will be available.  This would also require a
new DataSourceFactory class and force Tomcat users to specify a
different factory in their DataSource configs.

My other thought is that maybe the MBean interface should be implemented
in Tomcat somehow when the DataSource is created.  I'm not sure that's
the right thing either (and it would probably be more complicated to

I'm still thinking this through, but any feedback or ideas would be


View raw message