Hello,
are you using a Datasource, accessed via JNDI-Lookup?
Is the task to measure the call DataSource.getConnection()?

Or do you want to measure some calls within "getConnection"?
Maybe a Java agent can be useful to measure method calls.

Usually the borrowing process itself is not a time consuming operation.
If the pool is not properly sized and new connections must be established, that 
will cause lags and issues.

Greetings, Thomas



Von: Lasantha Samarakoon <lasn1...@gmail.com>
Gesendet: Sonntag, 12. September 2021 20:30
An: Tomcat Users List
Betreff: Re: Calculate time to get a connection from JDBC Pool
    
Hi John,

Thanks for your suggestion on the JMX approach. But as per my requirement,
using JMX to get the connection time will not be a viable solution.

My exact requirement is to log down individual connection establishment
time for each JDBC connection which is related to specific message flow. So
in this case, we won't be able to open up JMX (due to security concerns),
and also we will not be able to track down each JDBC connection object and
get the individual connection establishment time.

Thanks & Regards,

*Lasantha Samarakoon*
M: +94 (71) 214 1576 | E: lasn1...@gmail.com


On Tue, Sep 7, 2021 at 7:34 PM <john.e.gr...@wellsfargo.com.invalid> wrote:

> Lasantha,
>
>
> > -----Original Message-----
> > From: Lasantha Samarakoon <lasn1...@gmail.com>
> > Sent: Monday, September 06, 2021 10:22 PM
> > To: users@tomcat.apache.org
> > Subject: Calculate time to get a connection from JDBC Pool
> >
> > Hi all,
> >
> > I am working on Tomcat JDBC Pools and I have a requirement that needs to
> > calculate the total time it takes to get a connection from the JDBC pool.
> > This is to cover the entire connection borrowing process (includes
> connection
> > creation, setting up, validation, etc). The Tomcat version we are using
> is
> > 9.0.34.
> >
> > I tried playing around with the interceptors and also walked through the
> > respective implementation of Tomcat[1], but couldn't find any extensible
> > code segment to catch the before and after points of the get connection
> > flow.
> >
> > Appreciate your input on any possible solution for this.
> >
> > [1]
> >  https://urldefense.com/v3/__https://github.com/apache/tomcat/tree/9.0.3
> > 4/modules/jdbc-pool__;!!F9svGWnIaVPGSwU!6_tpBtEDTx2wg-
> > 2SBU2URViWoyhQPdrSNgVO7dErbhcA1-gh-KL_EtXutKh78PSXUt86mkU$
> >
> > TIA,
> > Lasantha
>
> I don't have an example on hand, but it looks like there is an MBean with
> the property meanBorrowWaitTimeMillis.  Enable JMX like this:
>
>  https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX
>
>
>
     
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to