How can I get the current number of client request threads in spring boot embedded tomcat?

China☆狼群 提交于 2019-12-11 01:47:05

问题


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?


回答1:


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]:

You can get those values programmatically, too.



来源:https://stackoverflow.com/questions/38079889/how-can-i-get-the-current-number-of-client-request-threads-in-spring-boot-embedd

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