Export JVM memory information on CentOS, and export jvm memory from centos

Source: Internet
Author: User

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

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.