Jcmd, Jstack, Jmap grab Bag

Source: Internet
Author: User
Tags stack trace

Jcmd is a JVM diagnostic command-line tool introduced from JDK 7 to send diagnostic commands to a running JVM

With the JDK version in place, the JFR files downloaded from Linux can be run locally and the following parameters should be added to the server JVM with the Linux environment:

-XX:+UnlockCommercialFeatures-XX:+FlightRecorder

Resin

<jvm-arg>-XX:+UnlockCommercialFeatures</jvm-arg><jvm-arg>-XX:+FlightRecorder</jvm-arg>

Then run the following command on the Linux environment to generate the JFR file:

su www -lc "/usr/java/jdk1.7.0_40/bin/jcmd ${ppid} JFR.start name=test duration=60s settings=default.jfc filename=output_`date +%m%d%H%M`.jfr"

After the file is generated successfully, download the corresponding JFR double click to view the relevant information. (Stack trace, code, hotspot method)

The other commands to use are as follows:

  jcmd                           ----查看JVM进程的PID  jcmd -l                          jcmd pid Thread.print   ----打印堆栈信息,功能类似于jstack -m pid

Other:

Jstack Thread: (632 is process ID)

su www -lc "/usr/java/jdk1.7.0_40/bin/jstack 632" > /home/www/jstack_out.txt

Jmap Memory:

su www -lc "jmap -F -dump:format=b,file=jmap.dat 6214"查看su www -lc "jhat -j -Xmx512m -port 9998 /home/www/jmap.dat"

Jcmd, Jstack, Jmap grab Bag

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.