Getting a list of active sessions in Tomcat using Java

后端 未结 9 1448
醉梦人生
醉梦人生 2020-12-08 20:34

I am developing a project in Java in which I want the count of all active sessions in Tomcat. Based on that I want to see how much of those users are active and actually usi

9条回答
  •  情歌与酒
    2020-12-08 21:20

    Two more approaches to add, both of which I've been using all the time.

    1. VisualVM

    To find out the number of active sessions, you can use Tomcat's internal statistics that can be accessed using JMX (Java Management Extension).

    Practically, a profiling tool such as VisualVM or Java VisualVM can be used to access the JMX statistics, such as the number of active sessions, on the MBeans tab (See below the screenshot)

    2. JavaMelody

    You can also use a JavaEE applications monitoring tool, such as JavaMelody, which helps you monitor Java or Java EE applications in QA and production environments.

提交回复
热议问题