commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <>
Subject RE: [DBCP] Proposal for additional metrics in DBCP and Pool - lon g
Date Sat, 05 Apr 2003 05:13:48 GMT
In our server, we've found it useful to keep track of totals using a pair of
numbers for each kind of total:  the "real" total and a "resetable" total.
This is quite useful for trouble shooting. Each pair is wrapped in an object
of course and named.


-----Original Message-----
From: Chris Halstead [] 
Sent: Friday, April 04, 2003 7:37 PM
Subject: [DBCP] Proposal for additional metrics in DBCP and Pool - long

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


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message