Monitor Tomcats internal threadpool without using JMX in a Spring Boot App

空扰寡人 提交于 2019-12-11 16:38:58

问题


I have a simple Spring Boot web application set up for handling incoming http requests.

Using the Java VisualVm I am able to see MBeans such as Tomcat's internal Threadpool. See the following screenshot:

Screenshot of the Java VisualVM's MBean viewer

I have successfully used JMX to monitor attributes such as "currentThreadCount" and "currentThreadsBusy". I set up Prometheus to access the monitored attributes as well. This works well.

However, now I wanted to know if it is possible to access these values without using JMX? I noticed that the abstract class https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/tomcat/util/net/AbstractEndpoint.html contains a method called getCurrentThreadCount(). The class Nio2Endpoint (https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/tomcat/util/net/Nio2Endpoint.html) extends AbstractEndpoint. So I imagine that this might be a way to retrieve these values.

Unfortunately I am not able to access the endpoints in any way. Can anybody tell me if it is possible at all to access them without using JMX?

Thank you very much!

来源:https://stackoverflow.com/questions/48440800/monitor-tomcats-internal-threadpool-without-using-jmx-in-a-spring-boot-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!