Java Analysis tool javOSize tutorial

Source: Internet
Author: User

Install

The installation is very simple to download from here. In fact, after the installation is complete, it is a jar package, which is similar to other jar installation packages and does not need to be configured.

Easy to use

The method of use is to attach the program to a java process first. In linux, I directly execute

Ps aux | grep java

It can be seen. No nonsense, get the java process pid, run java-jar javosize-1.0.9.jar pid is the pid number. Then you will see the following interface

The startup page indicates that the append is successful. let's take a look at what is there first. execute ls. there are several commands. I thought it was an executable file. the result is lost. after reading the official documentation, you can see that it is a directory. enter the corresponding directory. then execute ls to see the corresponding information. ls cannot be omnipotent .. run help in the corresponding directory to view all commands supported by the Directory. I personally think there are good functions.


All functional directories

Dynamic modification class

Go to the CLASSES directory and run

Ls | grep xxx

To find the class to be modified, and then you can directly edit it through vi. after the editing is complete, save it and replace it dynamically. the document says that jdk1.7 and above are supported, and 1.6 is not supported. no test.


Modify class demo

No need to restart to enable jmx

After mounting the file directly, execute cd REPOSITORY and then execute it.

Exec START_JMX_SERVER 6666

Intercept arbitrary code

You can dynamically add the aop method similar to Spring to print some call logs, troubleshoot online problems, go to the INTERCEPTOR directory, and add an INTERCEPTOR to a method of a class using the following methods.

Create TickServlet begin mypackage. Hello doGet System. out. println ("Servlet invoked ");

Detect memory leakage

Go to the REPOSITORY directory and execute exec TOP_FAT_STATIC_VARIABLES 5 com. apache. * to retrieve the five most occupied classes in a package.

Automatic performance detection

The PROBLEMS directory professionally solves this problem. After entering the Directory, execute the ls command. You will see this scenario.

Concurrency

Deadlocked: false

Memory

High GC (> 2%): false

Currently, only deadlocks and frequent GC are detected. It is very useful. The effect remains to be observed.

You do not need to restart to enable GC logs.

Just like activating jmx, go to the JMX directory and run

Exec java. lang: type = Memory. setVerbose (true );

Enabled.


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.