Export JVM memory information on CentOS, and export jvm memory from centos
First, check the Tomcat process Id:
[root@iZ25Z ~]# ps aux | grep javawww 2111 4.0 23.5 1637648 452756 ? Sl 10:12 4:35 /usr/java/jdk1.7.0_80/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties ...
We can see that the Tomcat process Id is 2111, and then use the JDK built-in tool jmap to export the memory information in the entire JVM:
# Jmap-dump: format = B, file = file name [pid] jmap-dump: format = B, file = mm. hprof 2111
However, we get this prompt:
jmap -dump:format=b,file=mm.hprof 21112111: Unable to open socket file: target process not responding or HotSpot VM not loadedThe -F option can be used when the target process is not responding
This is because I run this statement as the root user, but my tomcat process runs as a www user (you can see it using ps aux | grep java ). We can find a file like/tmp/hsperfdata _ $ USER/$ PID on the machine. When we execute jmap to display the above information, first, check whether the USER executing the command is consistent with the USER of the file 'file _ $ user'. If the USER is inconsistent, switch to the same one and then execute the command. Or, as prompted, simply add the-F parameter:
jmap -F-dump:format=b,file=mm.hprof 2111
Man page describes this option as follows:
-F Force. Use with jmap -dump or jmap -histo option if the pid does not respond. The live suboption is not supported in this mode.
Reprint please indicate the source, this article address: http://www.iiilab.com/article/6