Apache Tomcat请求线程 [英] Apache Tomcat Request Threads

查看:101
本文介绍了Apache Tomcat请求线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个泄漏了一点内存的应用程序,有点轻描淡写。

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

我正在使用 jvisualvm 尝试查找导致问题的原因。

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

我看到线程数量在以名称开头的线程上增长很多: http-8080-例如:http:8080-42

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.

我的问题是那些线程已经运行了很长一段时间(到目前为止10分钟)。

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

我的问题是:

My question is this:

我的假设是否正确?
如果是这样,为什么线程会运行这么长时间?当然它仍然无法忙于满足客户的请求?

推荐答案

Tomcat总是有许多等待的HTTP线程,例如,如果我们查看默认连接器设置:

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" />

我们可以看到应该总是至少有25个线程,但等待连接(最多maxThreads限制)。这由min和maxSpareThreads属性控制。

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.

JVisual VM说明线程正在等待或锁定资源等等什么?

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

这篇关于Apache Tomcat请求线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆