You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2017/08/23 20:17:11 UTC

Re: a question about tomcat thread

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

To whom it may concern,

On 8/22/17 10:28 PM, ophusky wrote:
> Server version: Apache Tomcat/8.0.35 Server built:   May 11 2016
> 21:57:08 UTC Server number:  8.0.35.0 OS Name:        Linux OS
> Version:     3.2.35 Architecture:   amd64 JVM Version:
> 1.8.0_45-b14 JVM Vendor:     Oracle Corporation

Thanks!

> 1. [root@app41 manager]# curl -s http://127.0.0.1/manager/status
> |grep -P -o 'Max threads:.*?<br> ' Max threads: 700 Current thread
> count: 478 Current thread busy: 17 Keeped alive sockets count:
> 5<br> 2. [root@app41 manager]# pgrep jsvc 25446 25447 [root@app41
> manager]# ps -Lf 25447 | wc -l 541

Okay.

> I want to figure out the meaning of "Current thread count"
> "Current thread busy" "Keeped alive sockets count" and relationship
> between 1 and 2.

Max threads >= current thread count
Current thread count >= current thread busy
Current thread count >= Keeped alive sockets count

> I have read the document
> http://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html#Server_Stat
us
>  if "Current thread busy" mean  "Parse and Prepare Request"  and 
> "Service"

Also "Finishing"

? "Keeped alive sockets count" mean  "Keep-Alive"?

Yes.

One question you didn't ask, but shows data for was "why does my
process have 541 threads when Tomcat says it's got 478 threads". The
answer is that Tomcat and the JVM are both running threads that are
not servicing requests.

Take a thread dump of your JVM to see what those other threads are
doing, and you'll see things like the "Finalizer" thread, various
threads for GC, JIT, AWT (if graphics subsystem has been launched),
the main thread itself, etc.

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

iQIcBAEBCAAGBQJZneLHAAoJEBzwKT+lPKRYjSoQALTyOs9Qs980nogOtLEJebE4
Ry/qff22vgDaR1rvJdxIDeu0RJVgliYdMZ1vr9G9ZCJHnkoL6rcjr4YUeTGt/VIT
DbpKCSFFszrg3QPQAxZD/QajACfedcPWNw0HXWy4Sc32tGdt+hh5L3iP89K1ig0U
HexwnLKm9LLl1P0ntRsPlcqBTijHsOdzdiJ1iEU/IkToJ0NH5pLY7vG0fysFKe0m
PyY/+Ndyt549+30J1YluLxqNi2pvd6syiD2YBcrqm17ZKzNbkOyY/Y7vqgsVnfda
ytsnq/maUxUgBQNCBx/nKPrfso8lBU3jNlhf6hSGCFJF6h6KVrmRmtFyZjeA1QMK
8AD0Nr0FiWChR3q6OvkdiS2JwhYzsi2UNseYoPtaxy71kjjrenaerW5wv0r+CPkX
Cw+DiAV5hZdp1APJZkSZaQxu1ii2sxJtQdHJ1sqZb8f6t5S4kD6wwoGeeuKWYq//
xXje9tlH8ONTw/oBteIIkF1bTLmPp1d04W8RMZv5keeuQ60lSIm4a6dJIeYzvubP
gnE++zCm1eoHOy/p2V+dQEHe//P7hrVkJ3qAzmbIxmADCrjNxJpFko5uD/nli0uG
FOZl315dBDIwJtri3KuPMtDqDziy3JKzlSlSTUSPlrP7dD77S44XfHEASBsTNULd
+OCGM5xsg2ksovWSH2QI
=kbDs
-----END PGP SIGNATURE-----

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


Re: a question about tomcat thread

Posted by Mark Thomas <ma...@apache.org>.
On 24/08/17 21:39, Christopher Schultz wrote:
> Mark,
> On 8/23/17 4:26 PM, Mark Thomas wrote:
>> On 23/08/17 21:17, Christopher Schultz wrote:

<snip/>

>>> Max threads >= current thread count Current thread count >=
>>> current thread busy Current thread count >= Keeped alive sockets
>>> count
> 
>> That is true for BIO, but not for any of the other connections
>> which are all non-blocking between requests. With those connectors
>> you can have up to maxConnections open sockets in HTTP keep-alive
>> waiting for data to arrive.
> 
> Yes, but the keep-alive connections are not using a thread from any
> pool. It's not clear to me whether "keeped alive sockets count"
> actually counts the sockets or the threads. I don't use the manager
> application for anything other than JMX :)

I'd assumed sockets rather than threads but I don't know for sure.

/me goes to look at source code...

It is sockets.

Mark

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


Re: a question about tomcat thread

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

Mark,

On 8/23/17 4:26 PM, Mark Thomas wrote:
> On 23/08/17 21:17, Christopher Schultz wrote:
>> To whom it may concern,
>> 
>> On 8/22/17 10:28 PM, ophusky wrote:
>>> Server version: Apache Tomcat/8.0.35 Server built:   May 11
>>> 2016 21:57:08 UTC Server number:  8.0.35.0 OS Name:
>>> Linux OS Version:     3.2.35 Architecture:   amd64 JVM
>>> Version: 1.8.0_45-b14 JVM Vendor:     Oracle Corporation
>> 
>> Thanks!
>> 
>>> 1. [root@app41 manager]# curl -s
>>> http://127.0.0.1/manager/status |grep -P -o 'Max
>>> threads:.*?<br> ' Max threads: 700 Current thread count: 478
>>> Current thread busy: 17 Keeped alive sockets count: 5<br> 2.
>>> [root@app41 manager]# pgrep jsvc 25446 25447 [root@app41 
>>> manager]# ps -Lf 25447 | wc -l 541
>> 
>> Okay.
>> 
>>> I want to figure out the meaning of "Current thread count" 
>>> "Current thread busy" "Keeped alive sockets count" and
>>> relationship between 1 and 2.
>> 
>> Max threads >= current thread count Current thread count >=
>> current thread busy Current thread count >= Keeped alive sockets
>> count
> 
> That is true for BIO, but not for any of the other connections
> which are all non-blocking between requests. With those connectors
> you can have up to maxConnections open sockets in HTTP keep-alive
> waiting for data to arrive.

Yes, but the keep-alive connections are not using a thread from any
pool. It's not clear to me whether "keeped alive sockets count"
actually counts the sockets or the threads. I don't use the manager
application for anything other than JMX :)

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

iQIcBAEBCAAGBQJZnzmKAAoJEBzwKT+lPKRY+fUP/ibWat/2gh/6sW+dM33HB9RX
lbv9crEOoc9VKxqiEkxYfkAXvHSlYMgNS8o1frjnvYucCvxYUp9RqkgH6KcZxtkA
imItAIXg5eg7ZZ5odpSrNqlG70S6ZM7mO8cWZWi9UCU0r84DQawBXxT6QRjkv3JI
+AqewX5KVP8CUItd/DT3YIfUvkGiLOPMCYuo8TJ4imXy5FySx2DTXArzHkC2LQ9p
bsu1fj5qtGS2IkQgLYQ0lzNxW3saDaqdm0CBMRzNsbNatz6pAsy432jmTZRPbHqE
xPuTuK+xEyHQaxiHae+PC85Mju93BjOa6txPB1IKMb9e8ihCK8CMXz9h81oirdU0
FrAiGtG8HJPwQ2W99tB4uKHYWvA5s104a9WQh1Cj//V0TKsx53Tp0f5H6qPPX+cP
MZDKGkHbhOLbsvyS1urcZ67uESIbAGvKcVHXk9FFta2O0GGzqvbAkN6sbc045JkJ
VVpQ6x/3o7YIxdLQj77n+h3AoLaXX6Cq3M/C/9byZXd0eP4OlOEdnkXnze1wfMJW
6Ova+D+D3tuvHJQjsyMkHfi3Fi72FGrZGdH5azIyn+UioxcE2x6f3RhT7bV9cqqc
0MBtGPfE6Bts7s6wN4bvhhTPPO13pV8J0c5sKpAE+MQkBuP+J9A2PRKoaKBYZfdn
8xC/wmJ2Lbeu41CWrMYm
=qLz/
-----END PGP SIGNATURE-----

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


Re: a question about tomcat thread

Posted by Mark Thomas <ma...@apache.org>.
On 23/08/17 21:17, Christopher Schultz wrote:
> To whom it may concern,
> 
> On 8/22/17 10:28 PM, ophusky wrote:
>> Server version: Apache Tomcat/8.0.35 Server built:   May 11 2016
>> 21:57:08 UTC Server number:  8.0.35.0 OS Name:        Linux OS
>> Version:     3.2.35 Architecture:   amd64 JVM Version:
>> 1.8.0_45-b14 JVM Vendor:     Oracle Corporation
> 
> Thanks!
> 
>> 1. [root@app41 manager]# curl -s http://127.0.0.1/manager/status
>> |grep -P -o 'Max threads:.*?<br> ' Max threads: 700 Current thread
>> count: 478 Current thread busy: 17 Keeped alive sockets count:
>> 5<br> 2. [root@app41 manager]# pgrep jsvc 25446 25447 [root@app41
>> manager]# ps -Lf 25447 | wc -l 541
> 
> Okay.
> 
>> I want to figure out the meaning of "Current thread count"
>> "Current thread busy" "Keeped alive sockets count" and relationship
>> between 1 and 2.
> 
> Max threads >= current thread count
> Current thread count >= current thread busy
> Current thread count >= Keeped alive sockets count

That is true for BIO, but not for any of the other connections which are
all non-blocking between requests. With those connectors you can have up
to maxConnections open sockets in HTTP keep-alive waiting for data to
arrive.

Mark

> 
>> I have read the document
>> http://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html#Server_Stat
> us
>>  if "Current thread busy" mean  "Parse and Prepare Request"  and
>> "Service"
> 
> Also "Finishing"
> 
> ? "Keeped alive sockets count" mean  "Keep-Alive"?
> 
> Yes.
> 
> One question you didn't ask, but shows data for was "why does my
> process have 541 threads when Tomcat says it's got 478 threads". The
> answer is that Tomcat and the JVM are both running threads that are
> not servicing requests.
> 
> Take a thread dump of your JVM to see what those other threads are
> doing, and you'll see things like the "Finalizer" thread, various
> threads for GC, JIT, AWT (if graphics subsystem has been launched),
> the main thread itself, etc.
> 
> -chris
> 
> ---------------------------------------------------------------------
> 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