Introduction to VISUALVM important tools in Java

Source: Internet
Author: User
Tags memory usage visualvm
VISUALVM Getting Started Guide

VISUALVM provides detailed information on Java applications running on Java virtual machines (Java virutal Machine, JVM). In the VISUALVM graphical user interface, you can easily and quickly view information about multiple Java applications.

This introductory guide should help you to quickly set up and run VISUALVM. This guide shows you how to install VISUALVM and how to add functionality to the tool by installing the plug-ins provided by the VISUALVM Update Center. This guide will also show you how to start VISUALVM, and how to view some of the information you can get about applications running on both local and remote JVMs.
VISUALVM Practice

The following brief screenshot shows the VISUALVM features originally described in java.sun.com:


install VISUALVM Download the VISUALVM installer from the VISUALVM project page. Unzip the VISUALVM installer to the local system. Navigate to the Bin directory of the VISUALVM installation directory, and then start the application. using the Applications window

After the application is started, the main window of the VISUALVM is opened. By default, the application window appears in the left pane of the main window. In the Applications window, you can quickly view Java applications running on both local and remote JVMs.

The application window is the main entry point for viewing specific application details. Right-clicking the application node opens the pop-up menu, from which you can choose whether to open the main application tab or generate a thread dump or heap dump.

For more detailed information about how to use the Applications window to view and save application-related data, see the following page: Using the Applications window (use the application windows) to browse heap dump

VISUALVM has a visual window through which you can easily browse the heap dump. You can mount an existing heap dump or generate a heap snapshot for an application that is running locally.

To build a heap dump for a local application, you can do any of the following: Right-click the application node in the Applications window and choose Heap dump. Double-click the application node in the application window to open the Application tab, and then, in the Watch tab, in the Monitor label, tap Heap dump.

To open a saved heap dump, choose File > Mount from the Main menu, and then locate the saved heap dump.

Browse Open Heap Dump: Click Classes on the heap Dump toolbar to view a list of activity classes and corresponding instances. Double-click a class name to open the instance view to view the list of instances. Select an instance from the list to view a reference to the instance.

After the heap dump is generated, VISUALVM opens the heap dump in the new tab and creates a node for the heap dump under the application node in the application window. To save the generated heap dump, right-click the heap dump node and select Save As. If the generated heap dump is not explicitly saved, the dump is deleted when the application shuts down.

For more information, see the following documentation: browsing a Heap dump (browse heap dump) profiling an application

VISUALVM includes a Profiler that you can use to perform profiling of applications running on the local JVM. You can access the profiling control in the "Profiler" tab of the Application tab. With this Profiler, you can analyze memory usage and CPU performance for local applications.
Note: To perform profiling on an application running on JDK 6, you need to turn off class sharing for that application, or the application may crash. To turn off class sharing, start the application with the-xshare:off parameter. Start the local Java application. (Use the-xshare:off parameter to start the application.) In the application window, under the Local node, right-click the application node and choose Open to open the application label. Click the "Profiler" tab in the Application tab. In the Profiler tab, click Memory or CPU.

After you select the profiling task, VISUALVM displays the profiling data in the Profiler tab.

For more information about profiling using VISUALVM, see the following documentation: profiling an application to connect to a remote host

With VISUALVM, you can easily monitor applications running on remote hosts and view general data about remote systems. To view information about an application on a remote host, you must first connect to a remote host. Connected remote hosts are listed under the remote node in the application window. Expand the Remote host node to view the applications running on the remote host.

To retrieve data from a remote application, you need to run the JSTATD utility on a remote JVM. For more information about how to start jstatd, see Jstatd-virtual Machine jstat Daemon (jstatd-Virtual machine jstat daemon). Unable to perform profiling of the application running on the remote host. Right-click the remote node in the Applications window and choose Add Remote host. In the Add Remote Host dialog box, type the host name or IP address of the remote computer. Optionally, type a display name for the remote host. This name will appear in the Applications window. If you do not enter a display name, the host name is used in the application window to identify the remote host. Click OK.

When you click OK, the remote host node is displayed under the remote node. Expand the Remote host node to view the Java applications running on the remote host.

You can double-click the name of the remote application to open the Application tab in VISUALVM.

For more information, see the following documentation: Working with remote applications install VISUALVM plug-in

You can add functionality to VISUALVM by installing the plug-ins provided by the VISUALVM Update Center. For example, installing the Visualvm-mbeans plug-in can add a "mbeans" label to the Application tab, through which you can monitor and manage Mbeans within the VISUALVM.

Install the VISUALVM plugin: Choose Tools > Plugins from the main menu. In the Available Plugins tab, select the Install check box for the plug-in. Click Install. Step through the plug-in installer.

This screenshot shows the plugins manager for the Visualvm-mbeans plug-in selected. Other VISUALVM documents

This document describes some of the features of VISUALVM. VISUALVM is designed to provide an intuitive visual interface that allows you to easily browse information about Java applications running on both local and remote JVMs. For more detailed information about using the VISUALVM feature, see the following documentation:

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.