Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

java - Apache Tomcat Request Threads

We have an application which leaks a bit of memory, a bit being an understatement.

I am using jvisualvm to try and find what is causing the problem.

I see the thread count grow quite a bit on threads starting with the name: http-8080- example: http:8080-42

My first guess is that each of those threads is a request hit from the client, as each client request is handled in its own thread.

My my problem is that those threads have been running for long periods of time (Thus far 10mins).

My question is this:

Is my assumption correct? If so, why is it that the Threads run for such a long time? Surely it can't still be busy serving the clients request?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Tomcat always has a number of waiting HTTP threads, for example if we look at the default connector setting:

<Connector port="80" maxHttpHeaderSize="8192"
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
              enableLookups="false" redirectPort="8443" acceptCount="100"
              connectionTimeout="20000" disableUploadTimeout="true" />

We can see that there should always be at least 25 threads live, but waiting for connections (up to the maxThreads limit). This is controlled by the min and maxSpareThreads attributes.

What does JVisual VM state that the thread is doing waiting or locked on a resource etc etc?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...