You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joleen Barker <ol...@gmail.com> on 2017/01/10 16:10:36 UTC

Best way to find out how many DB connections that are open at any given time

Hello All,

Details:
Tomcat Version: 7.0.64.0
Java Version: 1.8.0
OS: AIX 6.1
Database: Oracle 11

The web application installed on the server above makes data connections to
run file transfers from point A to point B. The default Database connection
setting that are set when the application server comes up are as follows:

DataBasePoolingFlag - APACHE
MaxActive - 400
MaxIdle - 20
MinIdle - 10

We had an incident where all these connections were actually used up due to
a script someone had that looped. I need to determine at any given point in
time how many DB connections exist from the web application to the DB.
There may be more than one way to do this. I am sure there is a DB command
that could be run against the schema but the schema is pointed to by many
servers. I am  wondering if there is a java command of some kind that I
could run that may tell me how many connections are open at that time or
possibly a tomcat or apache command.

Thank you for the help in advance.

Joleen

Re: Best way to find out how many DB connections that are open at any given time

Posted by Thomas Meyer <th...@m3y3r.de>.
You may also want to have a look at flexy pool - https://github.com/vladmihalcea/flexy-pool 

With kind regards
Thomas


With kind regards
Thomas

> Am 11.01.2017 um 01:36 schrieb Joleen Barker <ol...@gmail.com>:
> 
> As always, thank you Christopher, I'll take a look at the slides.
> 
> And Thank you to the other for pointing me in some directions for this.
> 
> -Joleen
> 
> On Tue, Jan 10, 2017 at 3:19 PM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> 
>> Joleen,
>> 
>>> On 1/10/17 11:10 AM, Joleen Barker wrote:
>>> Hello All,
>>> 
>>> Details: Tomcat Version: 7.0.64.0 Java Version: 1.8.0 OS: AIX 6.1
>>> Database: Oracle 11
>>> 
>>> The web application installed on the server above makes data
>>> connections to run file transfers from point A to point B. The
>>> default Database connection setting that are set when the
>>> application server comes up are as follows:
>>> 
>>> DataBasePoolingFlag - APACHE MaxActive - 400 MaxIdle - 20 MinIdle -
>>> 10
>>> 
>>> We had an incident where all these connections were actually used
>>> up due to a script someone had that looped. I need to determine at
>>> any given point in time how many DB connections exist from the web
>>> application to the DB. There may be more than one way to do this. I
>>> am sure there is a DB command that could be run against the schema
>>> but the schema is pointed to by many servers. I am  wondering if
>>> there is a java command of some kind that I could run that may tell
>>> me how many connections are open at that time or possibly a tomcat
>>> or apache command.
>> 
>> This may be helpful:
>> 
>> http://people.apache.org/~schultz/ApacheCon%20NA%202016/Monitoring%20Apa
>> che%20Tomcat%20with%20JMX.pdf
>> 
>> Slides 15-16 show you where you can find the DataSource information
>> via JMX, and then later on in the presentation there are slides to
>> show how you can get that information via HTTP instead of JMX. Scripts
>> are provided to fetch a value at intervals, track values over time, etc.
>> 
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>> 
>> iQIcBAEBCAAGBQJYdUHCAAoJEBzwKT+lPKRY8lAP/0C6wfLboz4K2MxaHR/86moX
>> sKIev9jV+wQ17n0nf1Wj1UA7GDGALye485Z2XMgIjlOaXmufVClfa3MWY07z+bv2
>> R67AmDQ797jlCwTAAhpaRtB0FJmX4cd0EnJkC9r03NCH+kPRIK8G91bkgn8ehw4L
>> x0jrgKO/N0UEpshNI/baPxRJRX7yr83g2ZHiKVoFAXM25rEcJNSPOkvlTkBxZ5Yv
>> RCQuobinJa9X64p8beYXSkO/9wbP+b5/wcUxpewfvByK9Hits+n33/Mbq5RpKlR7
>> vIHpwDJKlTo2/8ivIDHngIPiRQetlXEgwSWwN+5Fsr+V4bFSh6XnzIBAiB8SNoua
>> A9m71pyOoyQhdAAQzNfWwtLPWg9jrDaIRB7bj+HnbrKnCUa4rDyWfUDm4IwanfLW
>> QcDUggAgD151UstbSAQafLKJb0TBCWqHpIAvsJwCziOb6LnvtIf5xoLe7s48JZE9
>> 44YfDFI4qg0NSdP59vF/Z1Ho5sveScHrcgmB03BGWVunj9caclqKOWWnJOscAVLJ
>> UXQG0B6VvboLJRgKUU4/z0s1a2sOcTLRUz+H1Ib9giqLirI6NVYUSg0lEZdVm5BA
>> 0Ctwd6qD7G1j8e4ZiuChC3paCA0nYVhEea0dAVHXB+ZYER89yeoBzPkZnc/vWLEe
>> LO1AZaxZ2nDebk0ubBn9
>> =JgPw
>> -----END PGP SIGNATURE-----
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 

Re: Best way to find out how many DB connections that are open at any given time

Posted by Joleen Barker <ol...@gmail.com>.
As always, thank you Christopher, I'll take a look at the slides.

And Thank you to the other for pointing me in some directions for this.

-Joleen

On Tue, Jan 10, 2017 at 3:19 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Joleen,
>
> On 1/10/17 11:10 AM, Joleen Barker wrote:
> > Hello All,
> >
> > Details: Tomcat Version: 7.0.64.0 Java Version: 1.8.0 OS: AIX 6.1
> > Database: Oracle 11
> >
> > The web application installed on the server above makes data
> > connections to run file transfers from point A to point B. The
> > default Database connection setting that are set when the
> > application server comes up are as follows:
> >
> > DataBasePoolingFlag - APACHE MaxActive - 400 MaxIdle - 20 MinIdle -
> > 10
> >
> > We had an incident where all these connections were actually used
> > up due to a script someone had that looped. I need to determine at
> > any given point in time how many DB connections exist from the web
> > application to the DB. There may be more than one way to do this. I
> > am sure there is a DB command that could be run against the schema
> > but the schema is pointed to by many servers. I am  wondering if
> > there is a java command of some kind that I could run that may tell
> > me how many connections are open at that time or possibly a tomcat
> > or apache command.
>
> This may be helpful:
>
> http://people.apache.org/~schultz/ApacheCon%20NA%202016/Monitoring%20Apa
> che%20Tomcat%20with%20JMX.pdf
>
> Slides 15-16 show you where you can find the DataSource information
> via JMX, and then later on in the presentation there are slides to
> show how you can get that information via HTTP instead of JMX. Scripts
> are provided to fetch a value at intervals, track values over time, etc.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYdUHCAAoJEBzwKT+lPKRY8lAP/0C6wfLboz4K2MxaHR/86moX
> sKIev9jV+wQ17n0nf1Wj1UA7GDGALye485Z2XMgIjlOaXmufVClfa3MWY07z+bv2
> R67AmDQ797jlCwTAAhpaRtB0FJmX4cd0EnJkC9r03NCH+kPRIK8G91bkgn8ehw4L
> x0jrgKO/N0UEpshNI/baPxRJRX7yr83g2ZHiKVoFAXM25rEcJNSPOkvlTkBxZ5Yv
> RCQuobinJa9X64p8beYXSkO/9wbP+b5/wcUxpewfvByK9Hits+n33/Mbq5RpKlR7
> vIHpwDJKlTo2/8ivIDHngIPiRQetlXEgwSWwN+5Fsr+V4bFSh6XnzIBAiB8SNoua
> A9m71pyOoyQhdAAQzNfWwtLPWg9jrDaIRB7bj+HnbrKnCUa4rDyWfUDm4IwanfLW
> QcDUggAgD151UstbSAQafLKJb0TBCWqHpIAvsJwCziOb6LnvtIf5xoLe7s48JZE9
> 44YfDFI4qg0NSdP59vF/Z1Ho5sveScHrcgmB03BGWVunj9caclqKOWWnJOscAVLJ
> UXQG0B6VvboLJRgKUU4/z0s1a2sOcTLRUz+H1Ib9giqLirI6NVYUSg0lEZdVm5BA
> 0Ctwd6qD7G1j8e4ZiuChC3paCA0nYVhEea0dAVHXB+ZYER89yeoBzPkZnc/vWLEe
> LO1AZaxZ2nDebk0ubBn9
> =JgPw
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Best way to find out how many DB connections that are open at any given time

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Joleen,

On 1/10/17 11:10 AM, Joleen Barker wrote:
> Hello All,
> 
> Details: Tomcat Version: 7.0.64.0 Java Version: 1.8.0 OS: AIX 6.1 
> Database: Oracle 11
> 
> The web application installed on the server above makes data
> connections to run file transfers from point A to point B. The
> default Database connection setting that are set when the
> application server comes up are as follows:
> 
> DataBasePoolingFlag - APACHE MaxActive - 400 MaxIdle - 20 MinIdle -
> 10
> 
> We had an incident where all these connections were actually used
> up due to a script someone had that looped. I need to determine at
> any given point in time how many DB connections exist from the web
> application to the DB. There may be more than one way to do this. I
> am sure there is a DB command that could be run against the schema
> but the schema is pointed to by many servers. I am  wondering if
> there is a java command of some kind that I could run that may tell
> me how many connections are open at that time or possibly a tomcat
> or apache command.

This may be helpful:

http://people.apache.org/~schultz/ApacheCon%20NA%202016/Monitoring%20Apa
che%20Tomcat%20with%20JMX.pdf

Slides 15-16 show you where you can find the DataSource information
via JMX, and then later on in the presentation there are slides to
show how you can get that information via HTTP instead of JMX. Scripts
are provided to fetch a value at intervals, track values over time, etc.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYdUHCAAoJEBzwKT+lPKRY8lAP/0C6wfLboz4K2MxaHR/86moX
sKIev9jV+wQ17n0nf1Wj1UA7GDGALye485Z2XMgIjlOaXmufVClfa3MWY07z+bv2
R67AmDQ797jlCwTAAhpaRtB0FJmX4cd0EnJkC9r03NCH+kPRIK8G91bkgn8ehw4L
x0jrgKO/N0UEpshNI/baPxRJRX7yr83g2ZHiKVoFAXM25rEcJNSPOkvlTkBxZ5Yv
RCQuobinJa9X64p8beYXSkO/9wbP+b5/wcUxpewfvByK9Hits+n33/Mbq5RpKlR7
vIHpwDJKlTo2/8ivIDHngIPiRQetlXEgwSWwN+5Fsr+V4bFSh6XnzIBAiB8SNoua
A9m71pyOoyQhdAAQzNfWwtLPWg9jrDaIRB7bj+HnbrKnCUa4rDyWfUDm4IwanfLW
QcDUggAgD151UstbSAQafLKJb0TBCWqHpIAvsJwCziOb6LnvtIf5xoLe7s48JZE9
44YfDFI4qg0NSdP59vF/Z1Ho5sveScHrcgmB03BGWVunj9caclqKOWWnJOscAVLJ
UXQG0B6VvboLJRgKUU4/z0s1a2sOcTLRUz+H1Ib9giqLirI6NVYUSg0lEZdVm5BA
0Ctwd6qD7G1j8e4ZiuChC3paCA0nYVhEea0dAVHXB+ZYER89yeoBzPkZnc/vWLEe
LO1AZaxZ2nDebk0ubBn9
=JgPw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best way to find out how many DB connections that are open at any given time

Posted by Joleen Barker <ol...@gmail.com>.
Thank you Andre and calder.

On the AIX side this worked. I am limited also I think due to the shell. If
I use the -p tcp option it gives me a long list of counts of TCP
connections and bytes. This command gave me similar on AIX:

netstat -a|grep 1526

tcp        0      0  cpmfttapt21.51186      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.51198      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.51211      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55213      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55214      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55215      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.57493      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.57495      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35153      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35154      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35157      cpmfttdbt01-vip..1526
ESTABLISHED

On Tue, Jan 10, 2017 at 12:40 PM, André Warnier (tomcat) <aw...@ice-sa.com>
wrote:

> On 10.01.2017 18:06, Joleen Barker wrote:
>
>> Hi Andre - I played around a little more and ran the command netstat -a |
>> grep 1526 which is the port number and received information that looks
>> like
>> 11 connections are open at this time. Do you know what the number is that
>> follows the machine name in the forth column for example the 51186?
>>
>
> I do not know AIX. Maybe try :
> netstat -h
> and/or
> man netstat
>
> (and also try the command without the grep, to see the column headers)
>
>
>
>> netstat -a | grep 1526
>>
>> tcp        0      0  cpmfttapt21.51186      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.51198      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.51211      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.55213      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.55214      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.55215      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.57493      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.57495      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.35153      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.35154      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> tcp        0      0  cpmfttapt21.35157      cpmfttdbt01-vip..1526
>> ESTABLISHED
>>
>> On Tue, Jan 10, 2017 at 11:59 AM, Joleen Barker <ol...@gmail.com>
>> wrote:
>>
>> Hello Filippo - I do not have JConsole available and the proposed idea is
>>> past my knowledge level.
>>>
>>> Hello André - This was an interesting idea but it didn't work for me. I
>>> only have the ksh available and could only use netstat -p tcp but the
>>> output didn't make sense to me.
>>>
>>> On Tue, Jan 10, 2017 at 11:24 AM, André Warnier (tomcat) <aw...@ice-sa.com>
>>> wrote:
>>>
>>> On 10.01.2017 17:10, Joleen Barker wrote:
>>>>
>>>> Hello All,
>>>>>
>>>>> Details:
>>>>> Tomcat Version: 7.0.64.0
>>>>> Java Version: 1.8.0
>>>>> OS: AIX 6.1
>>>>> Database: Oracle 11
>>>>>
>>>>> The web application installed on the server above makes data
>>>>> connections
>>>>> to
>>>>> run file transfers from point A to point B. The default Database
>>>>> connection
>>>>> setting that are set when the application server comes up are as
>>>>> follows:
>>>>>
>>>>> DataBasePoolingFlag - APACHE
>>>>> MaxActive - 400
>>>>> MaxIdle - 20
>>>>> MinIdle - 10
>>>>>
>>>>> We had an incident where all these connections were actually used up
>>>>> due
>>>>> to
>>>>> a script someone had that looped. I need to determine at any given
>>>>> point
>>>>> in
>>>>> time how many DB connections exist from the web application to the DB.
>>>>> There may be more than one way to do this. I am sure there is a DB
>>>>> command
>>>>> that could be run against the schema but the schema is pointed to by
>>>>> many
>>>>> servers. I am  wondering if there is a java command of some kind that I
>>>>> could run that may tell me how many connections are open at that time
>>>>> or
>>>>> possibly a tomcat or apache command.
>>>>>
>>>>> Thank you for the help in advance.
>>>>>
>>>>>
>>>>> Hi.
>>>> Maybe an "out of the box" answer, not using java.
>>>> I don't know how the following commands fare under AIX, but on a Linux
>>>> system, the OS-level command :
>>>> ~# netstat -pan --tcp | grep ESTABLISHED
>>>> will show you pretty much all TCP connections that are established
>>>> between any process and any other, local or remote.
>>>>
>>>> Sample output :
>>>>
>>>> tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002
>>>>   ESTABLISHED 11096/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608
>>>>   ESTABLISHED 2677/java
>>>> tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002
>>>>   ESTABLISHED 11096/java
>>>> tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002
>>>>   ESTABLISHED 11096/java
>>>> tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002
>>>>   ESTABLISHED 11096/java
>>>> tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002
>>>>   ESTABLISHED 11096/java
>>>>
>>>> I presume that you could easily find out the process-id of your Tomcat,
>>>> and the port number under which the database is accessed.
>>>> It would be a simple matter to "grep" the above and count the lines, to
>>>> get the answer you seem to want.
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Best way to find out how many DB connections that are open at any given time

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 10.01.2017 18:06, Joleen Barker wrote:
> Hi Andre - I played around a little more and ran the command netstat -a |
> grep 1526 which is the port number and received information that looks like
> 11 connections are open at this time. Do you know what the number is that
> follows the machine name in the forth column for example the 51186?

I do not know AIX. Maybe try :
netstat -h
and/or
man netstat

(and also try the command without the grep, to see the column headers)

>
> netstat -a | grep 1526
>
> tcp        0      0  cpmfttapt21.51186      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.51198      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.51211      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55213      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55214      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55215      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.57493      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.57495      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35153      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35154      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35157      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> On Tue, Jan 10, 2017 at 11:59 AM, Joleen Barker <ol...@gmail.com>
> wrote:
>
>> Hello Filippo - I do not have JConsole available and the proposed idea is
>> past my knowledge level.
>>
>> Hello Andr� - This was an interesting idea but it didn't work for me. I
>> only have the ksh available and could only use netstat -p tcp but the
>> output didn't make sense to me.
>>
>> On Tue, Jan 10, 2017 at 11:24 AM, Andr� Warnier (tomcat) <aw...@ice-sa.com>
>> wrote:
>>
>>> On 10.01.2017 17:10, Joleen Barker wrote:
>>>
>>>> Hello All,
>>>>
>>>> Details:
>>>> Tomcat Version: 7.0.64.0
>>>> Java Version: 1.8.0
>>>> OS: AIX 6.1
>>>> Database: Oracle 11
>>>>
>>>> The web application installed on the server above makes data connections
>>>> to
>>>> run file transfers from point A to point B. The default Database
>>>> connection
>>>> setting that are set when the application server comes up are as follows:
>>>>
>>>> DataBasePoolingFlag - APACHE
>>>> MaxActive - 400
>>>> MaxIdle - 20
>>>> MinIdle - 10
>>>>
>>>> We had an incident where all these connections were actually used up due
>>>> to
>>>> a script someone had that looped. I need to determine at any given point
>>>> in
>>>> time how many DB connections exist from the web application to the DB.
>>>> There may be more than one way to do this. I am sure there is a DB
>>>> command
>>>> that could be run against the schema but the schema is pointed to by many
>>>> servers. I am  wondering if there is a java command of some kind that I
>>>> could run that may tell me how many connections are open at that time or
>>>> possibly a tomcat or apache command.
>>>>
>>>> Thank you for the help in advance.
>>>>
>>>>
>>> Hi.
>>> Maybe an "out of the box" answer, not using java.
>>> I don't know how the following commands fare under AIX, but on a Linux
>>> system, the OS-level command :
>>> ~# netstat -pan --tcp | grep ESTABLISHED
>>> will show you pretty much all TCP connections that are established
>>> between any process and any other, local or remote.
>>>
>>> Sample output :
>>>
>>> tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002
>>>   ESTABLISHED 11096/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608
>>>   ESTABLISHED 2677/java
>>> tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002
>>>   ESTABLISHED 11096/java
>>> tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002
>>>   ESTABLISHED 11096/java
>>> tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002
>>>   ESTABLISHED 11096/java
>>> tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002
>>>   ESTABLISHED 11096/java
>>>
>>> I presume that you could easily find out the process-id of your Tomcat,
>>> and the port number under which the database is accessed.
>>> It would be a simple matter to "grep" the above and count the lines, to
>>> get the answer you seem to want.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best way to find out how many DB connections that are open at any given time

Posted by calder <ca...@gmail.com>.
The fourth column is the "Local Address" (local machine) - in the case, a
machine-name (vs IP address) and the port value (such as 51186) the machine
is listening on. Of course, the machine-name will resolve to an IP address,
so in some netstat output, you might see
tcp  0  0  10.240.100.20:51186  10.240.100.55:1526  ESTABLISHED
- or possibly -
tcp  0  0  0.0.0.0:51186  10.240.100.55:1526  ESTABLISHED
- or possibly -
tcp  0  0  127.0.0.1:51186  10.240.100.55:1526  ESTABLISHED

This Local Address is the address to which the socket in question is bound
to and which it receives connections on.

The fifth column is the "Foreign Address" (destination machine), sometimes
shown with its port# (as is the case here) and a connection is established.


On Tue, Jan 10, 2017 at 5:06 PM, Joleen Barker <ol...@gmail.com>
wrote:

> Hi Andre - I played around a little more and ran the command netstat -a |
> grep 1526 which is the port number and received information that looks like
> 11 connections are open at this time. Do you know what the number is that
> follows the machine name in the forth column for example the 51186?
>
> netstat -a | grep 1526
>
> tcp        0      0  cpmfttapt21.51186      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.51198      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.51211      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55213      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55214      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.55215      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.57493      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.57495      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35153      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35154      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> tcp        0      0  cpmfttapt21.35157      cpmfttdbt01-vip..1526
> ESTABLISHED
>
> On Tue, Jan 10, 2017 at 11:59 AM, Joleen Barker <ol...@gmail.com>
> wrote:
>
> > Hello Filippo - I do not have JConsole available and the proposed idea is
> > past my knowledge level.
> >
> > Hello André - This was an interesting idea but it didn't work for me. I
> > only have the ksh available and could only use netstat -p tcp but the
> > output didn't make sense to me.
> >
> > On Tue, Jan 10, 2017 at 11:24 AM, André Warnier (tomcat) <aw...@ice-sa.com>
> > wrote:
> >
> >> On 10.01.2017 17:10, Joleen Barker wrote:
> >>
> >>> Hello All,
> >>>
> >>> Details:
> >>> Tomcat Version: 7.0.64.0
> >>> Java Version: 1.8.0
> >>> OS: AIX 6.1
> >>> Database: Oracle 11
> >>>
> >>> The web application installed on the server above makes data
> connections
> >>> to
> >>> run file transfers from point A to point B. The default Database
> >>> connection
> >>> setting that are set when the application server comes up are as
> follows:
> >>>
> >>> DataBasePoolingFlag - APACHE
> >>> MaxActive - 400
> >>> MaxIdle - 20
> >>> MinIdle - 10
> >>>
> >>> We had an incident where all these connections were actually used up
> due
> >>> to
> >>> a script someone had that looped. I need to determine at any given
> point
> >>> in
> >>> time how many DB connections exist from the web application to the DB.
> >>> There may be more than one way to do this. I am sure there is a DB
> >>> command
> >>> that could be run against the schema but the schema is pointed to by
> many
> >>> servers. I am  wondering if there is a java command of some kind that I
> >>> could run that may tell me how many connections are open at that time
> or
> >>> possibly a tomcat or apache command.
> >>>
> >>> Thank you for the help in advance.
> >>>
> >>>
> >> Hi.
> >> Maybe an "out of the box" answer, not using java.
> >> I don't know how the following commands fare under AIX, but on a Linux
> >> system, the OS-level command :
> >> ~# netstat -pan --tcp | grep ESTABLISHED
> >> will show you pretty much all TCP connections that are established
> >> between any process and any other, local or remote.
> >>
> >> Sample output :
> >>
> >> tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002
> >>  ESTABLISHED 11096/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608
> >>  ESTABLISHED 2677/java
> >> tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002
> >>  ESTABLISHED 11096/java
> >> tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002
> >>  ESTABLISHED 11096/java
> >> tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002
> >>  ESTABLISHED 11096/java
> >> tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002
> >>  ESTABLISHED 11096/java
> >>
> >> I presume that you could easily find out the process-id of your Tomcat,
> >> and the port number under which the database is accessed.
> >> It would be a simple matter to "grep" the above and count the lines, to
> >> get the answer you seem to want.
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>

Re: Best way to find out how many DB connections that are open at any given time

Posted by Joleen Barker <ol...@gmail.com>.
Hi Andre - I played around a little more and ran the command netstat -a |
grep 1526 which is the port number and received information that looks like
11 connections are open at this time. Do you know what the number is that
follows the machine name in the forth column for example the 51186?

netstat -a | grep 1526

tcp        0      0  cpmfttapt21.51186      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.51198      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.51211      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55213      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55214      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.55215      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.57493      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.57495      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35153      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35154      cpmfttdbt01-vip..1526
ESTABLISHED

tcp        0      0  cpmfttapt21.35157      cpmfttdbt01-vip..1526
ESTABLISHED

On Tue, Jan 10, 2017 at 11:59 AM, Joleen Barker <ol...@gmail.com>
wrote:

> Hello Filippo - I do not have JConsole available and the proposed idea is
> past my knowledge level.
>
> Hello André - This was an interesting idea but it didn't work for me. I
> only have the ksh available and could only use netstat -p tcp but the
> output didn't make sense to me.
>
> On Tue, Jan 10, 2017 at 11:24 AM, André Warnier (tomcat) <aw...@ice-sa.com>
> wrote:
>
>> On 10.01.2017 17:10, Joleen Barker wrote:
>>
>>> Hello All,
>>>
>>> Details:
>>> Tomcat Version: 7.0.64.0
>>> Java Version: 1.8.0
>>> OS: AIX 6.1
>>> Database: Oracle 11
>>>
>>> The web application installed on the server above makes data connections
>>> to
>>> run file transfers from point A to point B. The default Database
>>> connection
>>> setting that are set when the application server comes up are as follows:
>>>
>>> DataBasePoolingFlag - APACHE
>>> MaxActive - 400
>>> MaxIdle - 20
>>> MinIdle - 10
>>>
>>> We had an incident where all these connections were actually used up due
>>> to
>>> a script someone had that looped. I need to determine at any given point
>>> in
>>> time how many DB connections exist from the web application to the DB.
>>> There may be more than one way to do this. I am sure there is a DB
>>> command
>>> that could be run against the schema but the schema is pointed to by many
>>> servers. I am  wondering if there is a java command of some kind that I
>>> could run that may tell me how many connections are open at that time or
>>> possibly a tomcat or apache command.
>>>
>>> Thank you for the help in advance.
>>>
>>>
>> Hi.
>> Maybe an "out of the box" answer, not using java.
>> I don't know how the following commands fare under AIX, but on a Linux
>> system, the OS-level command :
>> ~# netstat -pan --tcp | grep ESTABLISHED
>> will show you pretty much all TCP connections that are established
>> between any process and any other, local or remote.
>>
>> Sample output :
>>
>> tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002
>>  ESTABLISHED 11096/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608
>>  ESTABLISHED 2677/java
>> tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002
>>  ESTABLISHED 11096/java
>> tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002
>>  ESTABLISHED 11096/java
>> tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002
>>  ESTABLISHED 11096/java
>> tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002
>>  ESTABLISHED 11096/java
>>
>> I presume that you could easily find out the process-id of your Tomcat,
>> and the port number under which the database is accessed.
>> It would be a simple matter to "grep" the above and count the lines, to
>> get the answer you seem to want.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Best way to find out how many DB connections that are open at any given time

Posted by Joleen Barker <ol...@gmail.com>.
Hello Filippo - I do not have JConsole available and the proposed idea is
past my knowledge level.

Hello André - This was an interesting idea but it didn't work for me. I
only have the ksh available and could only use netstat -p tcp but the
output didn't make sense to me.

On Tue, Jan 10, 2017 at 11:24 AM, André Warnier (tomcat) <aw...@ice-sa.com>
wrote:

> On 10.01.2017 17:10, Joleen Barker wrote:
>
>> Hello All,
>>
>> Details:
>> Tomcat Version: 7.0.64.0
>> Java Version: 1.8.0
>> OS: AIX 6.1
>> Database: Oracle 11
>>
>> The web application installed on the server above makes data connections
>> to
>> run file transfers from point A to point B. The default Database
>> connection
>> setting that are set when the application server comes up are as follows:
>>
>> DataBasePoolingFlag - APACHE
>> MaxActive - 400
>> MaxIdle - 20
>> MinIdle - 10
>>
>> We had an incident where all these connections were actually used up due
>> to
>> a script someone had that looped. I need to determine at any given point
>> in
>> time how many DB connections exist from the web application to the DB.
>> There may be more than one way to do this. I am sure there is a DB command
>> that could be run against the schema but the schema is pointed to by many
>> servers. I am  wondering if there is a java command of some kind that I
>> could run that may tell me how many connections are open at that time or
>> possibly a tomcat or apache command.
>>
>> Thank you for the help in advance.
>>
>>
> Hi.
> Maybe an "out of the box" answer, not using java.
> I don't know how the following commands fare under AIX, but on a Linux
> system, the OS-level command :
> ~# netstat -pan --tcp | grep ESTABLISHED
> will show you pretty much all TCP connections that are established between
> any process and any other, local or remote.
>
> Sample output :
>
> tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002
>  ESTABLISHED 11096/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608
>  ESTABLISHED 2677/java
> tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002
>  ESTABLISHED 11096/java
> tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002
>  ESTABLISHED 11096/java
> tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002
>  ESTABLISHED 11096/java
> tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002
>  ESTABLISHED 11096/java
>
> I presume that you could easily find out the process-id of your Tomcat,
> and the port number under which the database is accessed.
> It would be a simple matter to "grep" the above and count the lines, to
> get the answer you seem to want.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Best way to find out how many DB connections that are open at any given time

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 10.01.2017 17:10, Joleen Barker wrote:
> Hello All,
>
> Details:
> Tomcat Version: 7.0.64.0
> Java Version: 1.8.0
> OS: AIX 6.1
> Database: Oracle 11
>
> The web application installed on the server above makes data connections to
> run file transfers from point A to point B. The default Database connection
> setting that are set when the application server comes up are as follows:
>
> DataBasePoolingFlag - APACHE
> MaxActive - 400
> MaxIdle - 20
> MinIdle - 10
>
> We had an incident where all these connections were actually used up due to
> a script someone had that looped. I need to determine at any given point in
> time how many DB connections exist from the web application to the DB.
> There may be more than one way to do this. I am sure there is a DB command
> that could be run against the schema but the schema is pointed to by many
> servers. I am  wondering if there is a java command of some kind that I
> could run that may tell me how many connections are open at that time or
> possibly a tomcat or apache command.
>
> Thank you for the help in advance.
>

Hi.
Maybe an "out of the box" answer, not using java.
I don't know how the following commands fare under AIX, but on a Linux system, the 
OS-level command :
~# netstat -pan --tcp | grep ESTABLISHED
will show you pretty much all TCP connections that are established between any process and 
any other, local or remote.

Sample output :

tcp6       0      0 127.0.0.1:45095         127.0.0.1:11002         ESTABLISHED 11096/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53564         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53677         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53659         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53656         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53620         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:8009          127.0.0.1:53608         ESTABLISHED 2677/java
tcp6       0      0 127.0.0.1:45142         127.0.0.1:11002         ESTABLISHED 11096/java
tcp6       0      0 127.0.0.1:43558         127.0.0.1:11002         ESTABLISHED 11096/java
tcp6       0      0 127.0.0.1:45128         127.0.0.1:11002         ESTABLISHED 11096/java
tcp6       0      0 127.0.0.1:45069         127.0.0.1:11002         ESTABLISHED 11096/java

I presume that you could easily find out the process-id of your Tomcat, and the port 
number under which the database is accessed.
It would be a simple matter to "grep" the above and count the lines, to get the answer you 
seem to want.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best way to find out how many DB connections that are open at any given time

Posted by Filippo Machi <fi...@gmail.com>.
Ciao Joleen,
maybe you could retrieve this information connecting via JMX (JConsole,
VisualVM) to the tomcat instances.
According to the way the datasource is configured, you could find a JMX
bean exposing this information.
Before that, tomcat should be launched in a way JMX connections are allowed
from remote.
For example, connecting via JMX I can find something under Catalina/Data
Source/etc etc.
HTH


On Tue, Jan 10, 2017 at 5:10 PM, Joleen Barker <ol...@gmail.com>
wrote:

> Hello All,
>
> Details:
> Tomcat Version: 7.0.64.0
> Java Version: 1.8.0
> OS: AIX 6.1
> Database: Oracle 11
>
> The web application installed on the server above makes data connections to
> run file transfers from point A to point B. The default Database connection
> setting that are set when the application server comes up are as follows:
>
> DataBasePoolingFlag - APACHE
> MaxActive - 400
> MaxIdle - 20
> MinIdle - 10
>
> We had an incident where all these connections were actually used up due to
> a script someone had that looped. I need to determine at any given point in
> time how many DB connections exist from the web application to the DB.
> There may be more than one way to do this. I am sure there is a DB command
> that could be run against the schema but the schema is pointed to by many
> servers. I am  wondering if there is a java command of some kind that I
> could run that may tell me how many connections are open at that time or
> possibly a tomcat or apache command.
>
> Thank you for the help in advance.
>
> Joleen
>