如何在Spring Boot嵌入式tomcat中获取当前的客户端请求线程数? [英] How can I get the current number of client request threads in spring boot embedded tomcat?

查看:1015
本文介绍了如何在Spring Boot嵌入式tomcat中获取当前的客户端请求线程数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Spring Boot应用程序中使用嵌入式tomcat获取当前活动的客户端请求线程数,以便可以在执行器的度量标准端点上公开它.我不是在寻找活动会话,而是活动请求处理线程.最好,我也想通过每个连接器获取此数据.

I'd like to get the current number of active client request threads in a spring boot app using embedded tomcat so that I can expose it over actuator's metrics endpoint. I'm not looking for active sessions, but active request processing threads. Preferably, I'd like to get this data per connector as well.

有人在春季启动时了解如何获取此信息的任何好主意吗?

Does anyone have any ideas on a good way to get at this information in spring boot?

推荐答案

我不知道这是否是您要寻找的东西,但是您可以通过JMX获得类似的服务器值.您可以启动当前的Spring Boot应用并打开Java Mission Control([JDK目录]/bin).打开MBean浏览器,然后查看Tomcat->线程池-> [ConnectorName]:

I don't know if this is what you are looking for, but you can get serveral values like that via JMX. You can start you current Spring Boot app and open Java Mission Control ([JDK directory]/bin). Open MBean browser and have a look at Tomcat->Thread Pool->[ConnectorName]:

您也可以以编程方式获取这些值.

这篇关于如何在Spring Boot嵌入式tomcat中获取当前的客户端请求线程数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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