How do I create a thread dump via JMX?

前端 未结 4 822
Happy的楠姐
Happy的楠姐 2020-12-18 03:13

I have a Tomcat running as a Windows Service, and those are known not to work well with jstack. jconsole is working well, on the other hand, and I can see stacks of individu

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-18 04:08

    It would be helpful if you take a flight recording to get a deeper view on the JVM behavior, specially focusing on the Hot Methods.

    Usually, a recording of half an hour is enough. To trigger a recording, you must be logged in to the machines, and issue the following command:

    If using Java HotSpot 1.8.x:

    $JAVA_HOME/bin/jcmd VM.unlock_commercial_features $JAVA_HOME/bin/jcmd JFR.start duration=1800s settings=profile filename=/tmp/recording.jfr

    IF using java HotSpot 1.7.x:

    Edit your $HOME/conf/wrapper.conf file by adding the following parameters on JVM startup:

    wrapper.java.additiona.=-XX:+UnlockCommercialFeatures wrapper.java.additional.=-XX:+FlightRecorder

    (replace with the corresponding positional number )

    Then, have your instances restarted. Once done, issue the following command :

    $JAVA_HOME/bin/jcmd JFR.start duration=1800s settings=profile filename=/tmp/recording.jfr

    The flight recording wil produce a file on /tmp/recording.jfr upon termination.

提交回复
热议问题