Thanks Chris for an insight.
When you say "the number of open sockets and the number of 
Tomcatrequest-processing threads will be the same". Does that mean all sockets 
states whether its in Closed_wait,listening, stop etc... will consume a thread 
individually.If yes then does that imply if i count all the sockets bind to 
http port (all states ) it should not exceed the total no. of threads 
configured for my hTTP connector.But in certain cases i've seen that this count 
of sockets is more than the threads configured , is there any particular reason 
for this behavior. -vicky 


     On Tuesday, 16 June 2015 10:50 PM, Christopher Schultz 
<ch...@christopherschultz.net> wrote:
   

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

Vicky,

On 6/16/15 12:50 PM, vicky wrote:
> Server version: Apache Tomcat/7.0.22 Server built:  Sep 27 2011
> 09:40:50

Oh, wow, you really need to upgrade. There are a number of really
*really* important security updates that need to be applied.

Please stop now and make plans to upgrade to Tomcat 7.0.62.

> JVM Version:    1.6.0_24-b24 JVM Vendor:    Sun Microsystems Inc

You should know that Java 6 is no longer supported, and will not be
getting any security updates. I highly recommend that you upgrade to
Java 8 as soon as possible.

> In tomcat does the [number] of open sockets on http port (netstat 
> -anlp|grep 8080) equal the number of threads in use in tomcat?

> <Connector  port="8080" protocol="HTTP/1.1" 
> connectionTimeout="20000" redirectPort="8443" />

For your version (Tomcat 7) and Connector (BIO, the default for Tomcat
7), the number of open sockets and the number of Tomcat
request-processing threads will be the same. The BIO connector stands
for "blocking I/O", and each request is processed by a single thread
from start to finish, and each thread will wait for a new connection
to come in before being dispatched.

If you use an <Executor> in your server.xml, it can re-size itself so
that you don't have more threads allocated than you are actually
using. That may not be necessary for you, but I figured I'd mention it.

> Actually i want to understand how & when i can say that the all 
> threads in a tomcat are fully utilized that why it is responding 
> slow. Please help in understand.

If you want to monitor Tomcat, I suggest you read this:
http://wiki.apache.org/tomcat/FAQ/Monitoring

It talks about watching the thread usage. You can certainly watch
thread usage over time as well and see how many threads are in use.

Application slowness can be caused by any number of things, but
usually thread-usage isn't the problem unless you have a huge load and
a well-designed application. It's usually things like global
synchronization of certain resources, or too few database connections,
a database that hasn't been optimized properly for the load profile,
or inefficient handling of large amounts of data (e.g. using DOM
instead of SAX for XML document processing).

That said, you might still have a threading problem.

- -chris

>> <Connector port="8080" protocol="HTTP/1.1" 
>> connectionTimeout="20000" redirectPort="8443" />
> 
> Also, what Tomcat version? I'm guessing 6.0.x or 7.0.x. Can you
> give us the whole version number, including the "x" at the end?
> 
> - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools -
> http://gpgtools.org
> 
> iQIcBAEBCAAGBQJVgFM5AAoJEBzwKT+lPKRY18UP/RGonACYQZQlFuldUGRstKB8 
> mhllDqlDP3AK5/tMz2VIdVA1BR1Zs2+kpwZZLgEbYZLSJP/NuV5cgsXxNy/bAuLw 
> g3mZ7fmvTFQfck0G2UqXN/UQlmqTmJooFaWyn980yEwsAv2Fk809Cj4N+bgeseU1 
> 0hoUFZqTx2hM0ZXrlVdkACdk186rKfGBkInoKCNzkMn7xHxnip2PSxG3edBNnZQE 
> TI5eUFO++PgoWarmV+cf4HNYDEK2i1gEP0Yh81WVecZpBS2NxuEL2n3iiWcnX/WJ 
> 2Vd6ZzeDC8WLLeydCO2UaBLoP8hps+d23WT6pDq7latthr65exPNu3pMt34tZFdp 
> LH9d+DX6k6RxONIgSOxHNOe5tTBRJX3zXlXzT/d2oqaP3tvz8nW+EUZfqR6otvKX 
> MMznfECaZOJowSYzLDrSaWC0lMs6OJUM6uYYGYQp4JtdRAOhfqUndt1TgIzjTkgM 
> LYoRkfx0wGoiVst9pRZYgfqmef0yrKPduMuNsqiuBtS96u9ZCO21DPOs1Jt5aesG 
> Ll3nASR8gFaJAEjCLzy46O782k9Rjc0jDy0I3vsYIb2TlTkSnFo0jb/io9doJ0dr 
> 7EEWZoBb/QomQCwjmB3/I/bq0dSQP8ejrVIhrF+N9KK43TsbnJzzG0vm9RkDevqP 
> O8TDaRpqMsZQrBb6qSft =a4Gs -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVgFr7AAoJEBzwKT+lPKRYr9oP/1+yb22/0Rfwgm8xAVskTHAZ
PyvyS8N+NWobZ3nLrlfRf6SJaq51oNqARVK0PbourXejXGFFX4UK/Pl4Yo9iqxvM
IodCJDdBUeiXFW7vM7aaJyfalkhpEeG+kkl8zpzOaV1hVy9fa23vuz4yAyirHSRP
+WD4P/JoyS91lglhrAekyo3T4lWOGG0GMAefaV/WtxMYB9ZjrBwZqrhrzd4o8PwE
Hio52nxhU7CZu9vik6ffZA+j4z35BSoU7VMuey8lFQAVF1Tp3F/twX45hiNP45YZ
crMQiawA7XjSyhqtmKVFnMuKFE1e7b+KHzZGOafjLbd9SoLObfo/muafM9NSweE9
ZIOKmLUCbRo8H7Ny2xObjc09sCXVYbqy8FTFKKEEBZ2pVzuZfMa9Iko+B4xiSYz/
06rLzSLO9nt3929h7oQO7P+L4ov6j0rJQU2eNUzfNHAHpGLM3NhfbQyk19EERyEW
7LWzEzErU+S4iPFOZpTZfg5LVfSXtIfIdLskclTkRqk0TpwTTEF7xXgcCpuCtIst
19DPUnl3hNl8QVX6bx8kEelDHe7A1iTX27dBHKooer4fcB7jDp8FGwD/56SyiEpj
MD/QzX2tiXXtiVFhg66P/eym+Brq5Sospb83VPCvOpSwLwNBbov06NhvP8VXtJZl
Yd3/+aQyRYZ/n+IA0Aos
=xBcG
-----END PGP SIGNATURE-----

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



  

Reply via email to