AW: Calculate time to get a connection from JDBC Pool

2021-09-12 Thread Thomas Hoffmann (Speed4Trade GmbH)
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 
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  wrote:

> Lasantha,
>
>
> > -Original Message-
> > From: Lasantha Samarakoon 
> > 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



Re: Calculate time to get a connection from JDBC Pool

2021-09-12 Thread Lasantha Samarakoon
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  wrote:

> Lasantha,
>
>
> > -Original Message-
> > From: Lasantha Samarakoon 
> > 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
>
>
>


Server redirected too many times (20)

2021-09-12 Thread Barry Kimelman
I just installed tomcat 9.0.52 on my linux ubuntu 20.04 LTS system.

I was successfully able to run the manager app as a test.

Now I am trying to build an application that I had worked on quite a while
ago in an older version of tomcat.

I have a script which runs a series of ANT commands to build and install my
app which has always worked well.

Now with this version of tomcat when I run   ant remove I get the following
error messages

Buildfile: /home/barry/tomcat/hockey3/build.xml
Trying to override old definition of datatype resources

remove:

BUILD FAILED
/home/barry/tomcat/hockey3/build.xml:504: java.net.ProtocolException:
Server redirected too many  times (20)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1932)
at
java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:224)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:156)
at org.apache.catalina.ant.UndeployTask.execute(UndeployTask.java:41)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
at org.apache.tools.ant.Main.runBuild(Main.java:830)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Total time: 0 seconds

Here is the relavant  portion of my build.xml file


  48 

  79  
  80  

 127  
 128  
 129  
 130  
 131  
 132  
 133  
 134  http://localhost:8080/manager/text"/>
 135  
 136  

 487 
 488

 497
 498  
 500
 501
 505
 506  

I am puzzled.   What have IO done wrong ?

Thanks for your help.

-- 

==

Barry Kimelman
Winnipeg, Manitoba, Canada