You can use VISUALVM to generate and analyze massive amounts of data

Source: Internet
Author: User
Tags high cpu usage visualvm

You can use VISUALVM to generate and analyze massive amounts of data, track memory leaks, monitor the garbage collector, perform memory and CPU analysis, and also support browsing and operations on Mbeans. Although VISUALVM itself will run on this version of JDK6, it will be able to monitor the version of the program JDK1.4 above.

Installation
JDK1.6 Update7 in the version after the default is VisualVM, in the bin directory of the JVISUALVM is:

The JDK under MAC is installed by default in the/library/java/javavirtualmachines/version number directory.

Image

If you want to use the latest version, you can download it yourself in https://visualvm.java.net/. The latest version is 1.3.8 (released July 1, 2014)

VisualVM left navigation, we can see that it has "local", "Remote", "snapshot" and other functions. As my local xmind monitoring situation.

Image

The following analysis takes the example of Dubbo's demo example.

Memory analysis
Within the Monitoring tab, we can see the real-time application memory heap as well as the use of a permanent reserved zone.

Memory Heap Usage

Image

Permanent Retention of zone usage

Image

When an oom is dumped

In addition, we can right-click the application node through the Applications window to enable the "heap dump when oome occurs" feature, VisualVM will automatically generate a heap dump when an application OutOfMemory exception occurs.

Image

Memory Analysis Results

On the Profiler tab, clicking on the "Memory" button launches a memory analysis session, and so on VisualVM collects and counts the relevant performance data information, which will be displayed in the performance analysis results. Through the analysis of memory performance, we can see which objects occupy more memory, and the surviving cervical and lumbar diseases are longer, so as to make further optimization.
In addition, we can filter the analysis results by the class name filter below the performance analysis results.

Image

CPU Analysis
CPU Usage

Within the Monitoring tab, we can look at CPU usage and the performance impact of garbage collection activities. High CPU usage may be due to inefficient code in our project, which can be analyzed in detail using the Profiler tag's CPU performance analysis feature. If the garbage collection activity is too frequent and consumes high CPU resources, it may be caused by insufficient memory or unreasonable distribution of the new generation and old generation.

Image

CPU Performance Analysis Results

On the Profiler tab, click on the "CPU" button to start a CPU profiling session, VisualVM will detect all the methods that are called by the application. When entering a method, the thread issues a "method entry" event, which also emits a "method exit" event when exiting the method, all of which contain timestamps. The VisualVM then displays the total execution time and number of calls for each called method as long as the runtime is running.

You can use VISUALVM to generate and analyze massive amounts of data

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.