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