[Java Foundation]--JVM Graphical monitoring tool

Source: Internet
Author: User
Tags comments garbage collection memory usage cpu usage visualvm jconsole

Thank you for the original link: http://286.iteye.com/blog/1931574

The previous article has introduced some of the JDK's own monitoring tools, but these tools are based on the text interface, it is not intuitive to see the operation of the program fluctuations, this section introduces some of the graphical monitoring tools for easier and easier to monitor the use of.

Let's start with a few officially developed graphics monitoring tools:

1.jvmstat
Jvmstat is a graphical version of the Jstat, provided by the Java authorities, the latest version is currently 3.0.

Download Address: http://www.oracle.com/technetwork/java/jvmstat-142257.html

After downloading, unzip the following directory structure:


The directory structure is quite clear, it is easy to distinguish the function and function of each directory:
Bat:windows Startup program

Bin:linux Startup program

Docs: Related Documents

Etc:linux Dependent Libraries

Jars: Related jar packs

You need to configure the appropriate environment variables before using Jvmstat, and the environment variables are configured as follows: Shell code jvmstat_home:jvmstat installation directory JVMSTAT_JAVA_HOME:JDK directory, same as Java_home value

After configuring the two environment variables, you can run Jvmstat, run the command: Shell code VISUALGC PID #windows the system into the bat directory to run the command #linux the system into the bin directory after running the command

After the run interface automatically opens and displays the appropriate content, as shown in the figure:


From the jvmstat can be clearly observed in the assembly, loading, garbage collection consumption time and each region memory usage, in the figure S0 and S1 memory use is always repel, that is, at most only one will be in use. So jvmstat can only be used as a basic graphics monitoring tool.


comments:Jvmstat as a basic JVM graphical monitoring tool, the advantage is simple and easy to use, we can very intuitive observation of heap memory usage, of course, only for heap memory, so Jvmstat has certain limitations.

2.JConsole

Jconsole is a JMX-based graphical monitoring tool for connecting the running JVM, a graphical monitor similar to the one mentioned earlier, displaying various data graphically, and monitoring remote server VM conditions via remote connections, Jvmstat. Such tools can visually observe various changes, but are more resource intensive.

JDK8 Official Use instructions: https://docs.oracle.com/javase/8/docs/technotes/guides/management/jconsole.html

You need to add parameters:

-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=6002-dcom.sun.management.jmxremote.ssl=false -dcom.sun.management.jmxremote.authenticate=false

After JDK 1.5 jconsole has become the JDK's own monitoring tool, just enter it in the command line state: Java code jconsole

Can open the monitoring interface, the interface is as follows:


Select local monitoring or remote monitoring.

After entering the monitoring interface, there are some basic options to choose from, such as memory, threads, classes, and so on.

Selecting the memory option shows the use of heap and non heap memory, and so on.

Overview options: Monitor the JVM and some monitoring variables for information.
Memory Options: Memory usage information
Threading Options: Thread usage information
Class options: Class invocation information
VM Summary: JVM information
Mbean Options: The information Mbean for all Mbean shows all the Mbean that is registered in the general form on the JVM. An MBean allows you to get all platform information, including information that cannot be obtained from other tabs. Note that some of the information on the other tabs is also shown here in the Mbean. In addition, you can use an Mbean tag to manage your own application's Mbean.

Comment: compared with Jvmstat jconsole will be much more powerful, from the jconsole can not only monitor the memory of the situation, but also monitor such as: Thread, class, JVM parameters, etc. advanced information. Jconsole can also manually perform GC cleanup according to usage such as memory, which has brought great convenience to our program monitoring and good operation. It is noteworthy that Jconsole can monitor multiple JVM processes simultaneously, and can easily switch the monitoring interface in Jconsole.


3.Java VISUALVM
JDK1.6 Java introduces a new visual JVM monitoring tool: Java VISUALVM.

VISUALVM Official website: http://visualvm.java.net/

VISUALVM provides detailed information about Java applications running on a Java virtual machine. You can easily and quickly view information about multiple Java applications in the VISUALVM graphical user interface.


Running VISUALVM is very simple, just enter it in the command line state: Java code JVISUALVM


The VISUALVM will start automatically, and then you can see the following interface:



Through the Start Page prompts to enter the corresponding learning Document page, which has a wealth of tutorials and explanations, and are in Chinese.


The local list lists the resource occupancy of Java programs running on this computer, if the local Java program is running, start VISUALVM can see the corresponding program name, click on the program name to open the corresponding resource monitoring menu, in the form of graphics listing the program occupied by the CPU, HEAP, PermGen, class, and thread statistics, as shown in the figure:


Overview options

Monitoring options

Threading Options

The remote list lists the resource consumption of Java programs on the remote host, but requires running the JSTATD daemon on the remote host

More applications and usage can refer to official documents:

Http://visualvm.java.net/zh_CN/gettingstarted.html?Java_VisualVM

Comments: VISUALVM more powerful than Jconsole, which added a lot of functions and information, through VISUALVM can be more intuitive observation of various content details.

4.YourKit Java Profiler

Yourkit is an intelligent tool for analyzing Java and. NET applications, and Yourkit Java Profiler has been recognized by IT pros and analysts as the best analytical tool. CPU and memory usage can be analyzed with a very high level of professionalism through the Yourkit technology solution.
Yourkit Java Profiler also won the Java Developer ' s Journal (Java Developer Magazine) of the Editorial Selection award, its powerful features can be seen.

Yourkit Website official: http://www.yourkit.com
Yourkit Java Profiler Download Address: http://www.yourkit.com/download/index.jsp
The Yourkit Java Profiler provides support for Java and. NET two languages and supports basic all operating systems, with the latest version being 12.0.6.


The download interface is as follows:


Download and install:

After the installation is completed a run will be prompted to authorize the software, for individual users can actually free use Yourkit Java Profiler, simply fill in the download page below the appropriate authorization information to obtain authorization code, as shown:

After authorization, the run will display the Welcome page as follows:

On the Welcome page you can choose to monitor running JVM processes, install Eclipse Plug-ins, use tutorials, and so on.

Check "Show all running JVMs" will display all JVM processes in the dropdown list, select one of them to enter the monitoring interface:
The above figure is the CPU related information monitoring interface, from this interface can observe CPU usage information.

You can also open the memory management interface to view the various memory occupancy in the JVM:

Of course the functionality of Yourkit Java Profiler is more than that, we can also learn more advanced monitoring functions using yourkit Java Profiler Tube documentation, official tutorials Address: http://www.yourkit.com/docs/ index.jsp

Comments: Yourkit Java Profiler can be said to be unusually powerful, you can think of the Yourkit Java Profiler Basic implementation, so the powerful tool has no need for me to say anything, and even you can buy its paid version, I believe it will definitely let the small partners were stunned. This section is also just a trigger, and more advanced features require you to grope for yourself in practice.

Graphical monitoring tools can make us more intuitive in the course of the operation of the program to view the operation of the current program, so as to make corresponding judgments, monitoring procedures can make the work more convenient, but to build a stable and efficient system is the pursuit of the ultimate goal.

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.