You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jo...@wellsfargo.com.INVALID on 2019/02/08 17:09:27 UTC

Does Tomcat count incoming connections?

Hi all,

I'm interested in knowing how many new incoming connections are being created, possibly per connector.  Does Tomcat have such a thing?  I assume it would involve counting calls to ServerSocketChannel.accept() or something like that.  I see the GlobalRequestProcessor MBean has a request count, but I would also like to know connection count.

Thank you

John


Re: Does Tomcat count incoming connections?

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

Ronald,

On 2/8/19 15:39, Roskens, Ronald wrote:
> 
> 
>> -----Original Message----- From:
>> John.E.Gregg@wellsfargo.com.INVALID 
>> [mailto:John.E.Gregg@wellsfargo.com.INVALID] Sent: Friday,
>> February 08, 2019 2:24 PM To: users@tomcat.apache.org Subject:
>> [[EXTERNAL]] RE: Does Tomcat count incoming connections?
>> 
>> Chris,
>> 
>> 
>>> -----Original Message----- From: Christopher Schultz
>>> <ch...@christopherschultz.net> Sent: Friday, February 08, 2019
>>> 11:48 AM To: users@tomcat.apache.org Subject: Re: Does Tomcat
>>> count incoming connections?
>>> 
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>> 
>>> John,
>>> 
>>> 
>>> You can get this count from the Connector via JMX.
>>> 
>>> Look at the tree under
>>> /Catalina/GlobalRequestProcessor/[connector] and there is a
>>> "requestCount" attribute that can be queried.
>>> 
>>> Looks like it's an int value, so it can overflow.
>>> 
>>> - -chris
>> 
>> Thanks but the requestCount really does appear to be requests and
>> not connections.  I have keepAliveTimeout and
>> maxKeepAliveRequests at their defaults (unlimited timeout and 100
>> requests) and I see the count go up with each request, even
>> though my client reports that the connection is getting reused.
>> 
>> I'm asking because I need some hard data on whether clients are
>> reusing their connections for performance reasons.
> 
> How about the Catalina Threadpool ?
> 
> It has busyThreads, active connections, poller threads, and
> keep-alive threads metrics.

Hmm.

My initial thought was that the thread pool would be unaware of the
incoming connections because typically the thread pool is only used to
dispatch a request to a request processing thread (in the standard
servlet blocking-I/O model). Things obviously get more complicated
with the asynchronous dispatch model and Websocket.

But there is in fact a connectionCount property of the "ThreadPool"
MBean, which is really exposing the information being kept by an
instance of the AbstractEndpoint class.

If you look at the connection-state management, you'll see that this
value will go up and down as connections are made and broken rather
than being a count of total connections ever made. If this is what you
are looking for, then I think you can go ahead and use it. If you want
a total-count of all time, it looks like adding it to the
AbstractEndpoint is the way to go.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxgNZsACgkQHPApP6U8
pFip2xAAjjpdmM2slIG/IpsZVfDc75dY1mRHQIHdNOUxSUftclY7wzqEjw9qjTCN
X/lfW0cvUQ+r0MpnuP93Y13xg0scgV5CEnscKFT94XFfwhba6ilMJcNOGVk28Nr+
YFQ+iHR3VOB4rzsdjSWpIk9PyrwJA3f4+mM3KjZaR0PKrzcEbJulPiUYG7Yfv+Vf
KQ8tO4PeI8T644FcV1cNECUmqORX8xN26HKMM2k/jqqHdv934PAKk6qsmiS367VL
KDokbEREzMk8J3aph6dhiszDbIm69dQkvlcEbVZ/tSrwS6pQE2HYlat5fA/RCYzM
U72U/+7ybVcC/9DlDegdj50k82JNBIBFPSioBeEFlw5QpDSnFpQe91Aig88CO7vE
GkLWlWcFj50Z1tbLSKL1mcGG+q6w//ubJa6bqrhf10n7SDwqI1XutA7LksSuFTVk
6gXwmiWD4XKRuNRHhs6SFyhVKBa9xEWuq8iYcYEnFZi4xHRUR3TWc4E9/34koGWy
ovzCBcp08ZYa9xUq993U+/2IYbnomVtI3O0N38eKFZFPmpFRphJTkFllamUQLzDB
4mc8GQTVJEQKOKnKlx3y+EVHX6O4INbU2YNzM3/XAveP4vW6qluFSicriL4zyvcj
MgLJwSf+HVIpymyohcxqTFyBaB9vEZrWG8nskdDwN66cnlnu0Pw=
=fC92
-----END PGP SIGNATURE-----

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


RE: Does Tomcat count incoming connections?

Posted by "Roskens, Ronald" <Ro...@biworldwide.com>.

> -----Original Message-----
> From: John.E.Gregg@wellsfargo.com.INVALID
> [mailto:John.E.Gregg@wellsfargo.com.INVALID]
> Sent: Friday, February 08, 2019 2:24 PM
> To: users@tomcat.apache.org
> Subject: [[EXTERNAL]] RE: Does Tomcat count incoming connections?
> 
> Chris,
> 
> 
> > -----Original Message-----
> > From: Christopher Schultz <ch...@christopherschultz.net>
> > Sent: Friday, February 08, 2019 11:48 AM
> > To: users@tomcat.apache.org
> > Subject: Re: Does Tomcat count incoming connections?
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > John,
> >
> >
> > You can get this count from the Connector via JMX.
> >
> > Look at the tree under /Catalina/GlobalRequestProcessor/[connector]
> > and there is a "requestCount" attribute that can be queried.
> >
> > Looks like it's an int value, so it can overflow.
> >
> > - -chris
> 
> Thanks but the requestCount really does appear to be requests and not
> connections.  I have keepAliveTimeout and maxKeepAliveRequests at their
> defaults (unlimited timeout and 100 requests) and I see the count go up with
> each request, even though my client reports that the connection is getting
> reused.
> 
> I'm asking because I need some hard data on whether clients are reusing
> their connections for performance reasons.

How about the Catalina Threadpool ?

It has busyThreads, active connections, poller threads, and keep-alive threads metrics.

Ron

----------------------------------------------------------------------
This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you.

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


Re: Does Tomcat count incoming connections?

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

John,

On 2/8/19 15:24, John.E.Gregg@wellsfargo.com.INVALID wrote:
>> -----Original Message----- From: Christopher Schultz
>> <ch...@christopherschultz.net> Sent: Friday, February 08, 2019
>> 11:48 AM To: users@tomcat.apache.org Subject: Re: Does Tomcat
>> count incoming connections?
>> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> John,
>> 
>> 
>> You can get this count from the Connector via JMX.
>> 
>> Look at the tree under
>> /Catalina/GlobalRequestProcessor/[connector] and there is a
>> "requestCount" attribute that can be queried.
>> 
>> Looks like it's an int value, so it can overflow.
>> 
>> - -chris
> 
> Thanks but the requestCount really does appear to be requests and 
> not connections.  I have keepAliveTimeout and maxKeepAliveRequests
> at their defaults (unlimited timeout and 100 requests) and I see
> the count go up with each request, even though my client reports
> that the connection is getting reused.> I'm asking because I need
> some hard data on whether clients are reusing their connections for
> performance reasons.
I'm really sorry. I must admit I read the first sentence and not the
second and told you something you already wrote in your first post :(

I don't see anywhere that a connection count is currently available,
but it doesn't seem like it would be that much work to add it. I'm not
sure what the best place to /put it/ would be, since there really
isn't anything that coarse-grained in the JMX tree at this point.

For example, the GlobalRequestProcessor is, as the name suggests,
request-oriented. I think the ProtocolHandler is much the same. The
Connector itself is, unfortunately, mostly useless because it just
shows the configuration of the connector and nothing really live.

Hopefully Mark or Rémy will reply; they both understand the connection
management at a very low level and will probably say "already done!"
or "eww... that's going to be complicated." With luck, the former.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxd6GYACgkQHPApP6U8
pFjshQ/9E/6rZJQFeOxG6inXp7WjeJYb4tm1tlaA+DUeWhRBVTjnl3FT7yVmD3O5
ZxXt4oelVeeCyhqWVlKOYvAPL5N24gZYJMiRJB5CA33rQrpmmiLLQ9dH6glssTDM
5BWCp2rvMMlns6fpVu7X+FEcIS+yh/Ps4Ttb6SsoRWIdFkpAChO5/qZB2uHrV15Y
1L2sKf9djmZVx3w3nmb9HmcNMTsPa/iE1PpxAcXEF566P6jxKrqhLn/nkhgFeOb4
72EUA+ctd5oPpRyCl/BbbdmPVIzRBD+HP0JAjGA4HPYO6oKoAXwvvveGwA5U3MFJ
rOQyZhfZ97a0qVC+9sqNJ6twdv+5xzJr/EybRNndKA+imMP86wC8nqAJCRHuK5Y5
YiHKJlXNu3vmqnbODyplWWIqyuKtDfIopGZQyHatRU2iV3Zki3JhfhAb1eMPjISn
dS8qY3+/y8YGbKa7ZEurEO0qdW8j4KTUKixx3Qqft7vNexzk3YAm4mN+hLgzptZk
Twlo1FD8qJEHiRUk9QB79Z8m+NqcQDdNanMg1fPeEgpdt6hzLT3P3eulE8zL6Qy2
W71cLeF4Z5/xrQhd5cdWwgFWTy/h2E4P9hmEMK+hVrPdwWRslpvBGOGWUiR93pbm
yRxou6fsi4cYX4ZWIuiJH0bRNcM27kyhdxYs5GIhh6n0MWm7IbE=
=ktWZ
-----END PGP SIGNATURE-----

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


RE: Does Tomcat count incoming connections?

Posted by Jo...@wellsfargo.com.INVALID.
Chris, 


> -----Original Message-----
> From: Christopher Schultz <ch...@christopherschultz.net>
> Sent: Friday, February 08, 2019 11:48 AM
> To: users@tomcat.apache.org
> Subject: Re: Does Tomcat count incoming connections?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> John,
> 
> 
> You can get this count from the Connector via JMX.
> 
> Look at the tree under /Catalina/GlobalRequestProcessor/[connector]
> and there is a "requestCount" attribute that can be queried.
> 
> Looks like it's an int value, so it can overflow.
> 
> - -chris

Thanks but the requestCount really does appear to be requests and not connections.  I have keepAliveTimeout and maxKeepAliveRequests at their defaults (unlimited timeout and 100 requests) and I see the count go up with each request, even though my client reports that the connection is getting reused.

I'm asking because I need some hard data on whether clients are reusing their connections for performance reasons.

John

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


Re: Does Tomcat count incoming connections?

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

John,

On 2/8/19 12:09, John.E.Gregg@wellsfargo.com.INVALID wrote:
> I'm interested in knowing how many new incoming connections are
> being created, possibly per connector.  Does Tomcat have such a
> thing?  I assume it would involve counting calls to
> ServerSocketChannel.accept() or something like that.  I see the
> GlobalRequestProcessor MBean has a request count, but I would also
> like to know connection count.

You can get this count from the Connector via JMX.

Look at the tree under /Catalina/GlobalRequestProcessor/[connector]
and there is a "requestCount" attribute that can be queried.

Looks like it's an int value, so it can overflow.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxdwLsACgkQHPApP6U8
pFg3oQ/9Ey53oVrsO7Z2kxjnMJPEbLLKf4UV9J9GMSuolTR2Bd9LaqBGhjbcwCwm
cRfGwvywzVihazJNZcHuPZI0SftdpGjWMay/vnJbaxsyzgqj09WCnR9QFYlOJx4x
B73E0OAllGXW11XlgnfC/XCeH2OdIjRwHFCSwoLQ0RfzKAHp54KBGzGJODxWUfWV
uDjDmSLBxT37SdwpUehx8MtbJB9Z/Hp28zIrmjNrFHIcPwJ19HFYxe+I5nyqPHgA
4qniywWghcQErnBAfYJB/IJn66gBI7eH1UwJKOVQJ56VDFphjpjiXZX3AxFIe586
NylvXO0xcMkO4c91RiZwPh0fXvzT2s+1DP1ZI7ruDWtQ7+oJlv3DniJbfbQHN2pM
Elax5g367fPSEWItZ8aS+Yy1UyEsDAZt/fGe9qB+Gvbqld0U0ppJ6qBqKVYz4+4T
GVS/vO3bdcG11S/Yp7b+4ImjfEUL3OI46mN7G3BhapRS8r8tzuThoqKnTpQQI69O
LCSs5Sqmeot8lbjGWnDtFmG+dBCyXPQ2H2tBhDid2HXyiDoQhArTezGHoD6h3Rqa
b2Q3WdiSLtWP2Lffwym/AHbavwfE/6eUvCtWhXBNG2KHT9JTwAj/w/zBAFYsM5MD
jTdbN4gf8g+ZNjjWL3NJivbkTS5N3yx0CW2eK+T4Vq16aCw+VOo=
=cPja
-----END PGP SIGNATURE-----

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