Monitor remote JVM CPU JPS using Java VISUALVM

Source: Internet
Author: User
Tags visualvm

We often need to do a variety of testing of our development software, software use of system resources is not limited , there are a number of monitoring tools , compared to jprofiler system resources, especially memory consumption is very large, JDK1.6 began to bring the VISUALVM is a good monitoring tool.
This tool is in the java_home\bin\ directory of the Jvisualvm.exe, double-click the file will be able to see a more intuitive interface


As you can see from the left applications tree, you can monitor not only the local JVM operation, but also the JVM running on the remote machine.
Local monitoring: Whenever a Java program is opened, it is automatically added to local monitoring.

Because local monitoring does not need to be configured, this is mainly about monitoring remote JVMS
For remote monitoring, the VISUALVM of this machine must communicate with the remote JVM,VISUALVM currently supports two types ofRemote connection mode.
respectively isJSTATD andJMX Way: Here I mainly introduce through the JMX way.

Connecting a remote machine via JMX requires the following configuration:
1. Modify the remote machine JDK configuration file (I am here for the remote machine is Linux).
A. Enter the java_home\jre\lib\management\ directory
B.Copy jmxremote.password.template This file to the current directory and rename it toJmxremote.password
C. OpenJmxremote.password file, remove# Monitorrole QED and# Controlrole The comment symbols in front of these two lines

2. Modify the configuration file for the program that needs to be monitored on the remote machine (I am here to monitor the application deployed within the Tomcat container).
A. Enter the Tomcat_home\bin directory
B. Opencatalina.sh file, add the following information:
java_opts= "$JAVA _opts-djava.rmi.server.hostname=192.168.0.237
-dcom.sun.management.jmxremote.port=18999
-dcom.sun.management.jmxremote.ssl=false
-dcom.sun.management.jmxremote.authenticate=false "
C. Restart the Tomcat service.

3. Client VISUALVM configuration (my client is using WinXP).
A. Direct anti-key Click Remote, select Add Remote Host ...
B. Enter the IP address (192.168.0.237) of the remote machine in the popup interface and the IP address will be added to the Remotes node.
C. Counter-click on this IP address, select Add JMX Connection, enter the port number (18999) that you just configured in the popup interface, and the connection will be added to the IP node.
D. Counter-click on this connection and select Open.

At this point you can see the monitoring interface, from the interface we can see the CPU information, memory information, statistics load class number, thread information.

Monitor remote JVM CPU JPS using Java VISUALVM

Related Article

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.