Tomcat线程监视Mbeans描述 [英] Tomcat Thread Monitoring Mbeans Description

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

问题描述

在Tomcat的与线程相关的Mbean中,我在Catalina.ThreadPool下看到了.

In thread related Mbeans of Tomcat I see under Catalina.ThreadPool.

有不同的属性,即. maxThreads,currentThreadCount,currentThreadsBusy等.

there are different attributes viz. maxThreads, currentThreadCount, currentThreadsBusy etc.

因此,在哪里可以得到这些Mbean属性的描述, 这些属性分别表示什么,我需要在监视自动化代码中包括该属性,该代码将提供线程利用率统计信息.

So, where can I get the description of these Mbean attributes, what each of these attribute is indicating, I need to include this in my monitoring automation code, Which will provide the Thread utilization stats.

我也想看一下源代码,在哪里可以得到它?

also possible I would like to see the Source code, where can I get it?

当我看到Mbean类名(通过jconsole)时,它显示为org.apache.tomcat.util.modeler.BaseModelMBean,但是当我查看BaseModelMBean的源代码时,我看到没有字段或数据成员代表这些此类的上面部分提到的属性或它实现的接口.

When I see the Mbean class name (through jconsole) it shows as org.apache.tomcat.util.modeler.BaseModelMBean, but when I go through the source code of BaseModelMBean I see there are neither fields or data members representing these attributes mentioned above part of this class or the interfaces it implements.

然后在这里表示Mbean的哪个实现?

Then which implementation of the Mbean is being represented here??

推荐答案

maxThreads,currentThreadCount,currentThreadsBusy JMX属性与Tomcat连接器用来处理传入请求的线程池有关.您可以在应用程序线程列表中看到通常名为http-nio-[port-number]-exec-[sequence-number]的线程. 当请求到达连接器时,连接器将通过线程池为该连接器分配某个线程,该线程将一直处于忙碌"状态,直到处理该请求为止.因此, currentThreadsBusy 反映了当前正在处理的请求数.

maxThreads, currentThreadCount, currentThreadsBusy JMX properties relate to a thread pool the Tomcat Connector uses to handle incoming requests. You can see the threads usually named http-nio-[port-number]-exec-[sequence-number] in your application thread list. When a request arrives to the Connector, the latter assigns, by the means of a thread pool, a certain thread to it, this thread will by "busy" until the request is handled. So, currentThreadsBusy reflects the number of the requests that are being currently handled.

maxThreads 定义在任何情况下都不希望超过的线程数.当currentThreadsBusy计数器达到maxThreads阈值时,无法再处理更多请求,并且应用程序阻塞.

maxThreads defines the number of the threads you don't want to exceed in any case. When currentThreadsBusy counter reaches maxThreads threshold, no more requests could be handled, and the application chokes.

currentThreadCount 指示线程池当前拥有的线程数量(繁忙和空闲),如果线程在一段时间内未使用或创建新线程,则线程池将终止某些线程到maxThreads,如果有需求,请参见下面的详细信息.

currentThreadCount indicates the amount of threads the thread pool has right now, both busy and free, thread pool will terminate some threads if they are unused for a certain period of time or create new ones, up to maxThreads, if there is a demand, see the details below.

深入了解",从Tomcat 7开始,org.apache.tomcat.util.net.AbstractEndpoint负责线程管理.如果它使用java.util.concurrent.ThreadPoolExecutor作为线程池(默认选择),则maxThreads映射到ThreadPoolExecutor的maximumPoolSize,currentThreadsBusy-映射到activeCount,currentThreadCount-映射到poolSize.

"Under the hood", since Tomcat 7, it is org.apache.tomcat.util.net.AbstractEndpoint that is, among other things, responsible for thread management. If it uses java.util.concurrent.ThreadPoolExecutor as a thread pool (default choice), maxThreads maps to the ThreadPoolExecutor's maximumPoolSize, currentThreadsBusy - to activeCount, and currentThreadCount - to poolSize.

话虽如此, currentThreadsBusy 监视Web应用程序运行状况的最佳选择. maxThreads更像是一个静态值(除非您随意更改它). currentThreadCount 可能会提供一些有用的信息,但要有一定的时间间隔.

Having said that, currentThreadsBusy is the best choice for monitoring a web application's health. maxThreads is more like a static value (unless you change it dynamically, at will). currentThreadCount may deliver some helpful information, with a certain time lag.

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

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