Using JDK1.5 new tool to monitor system performance

Source: Internet
Author: User
Tags time interval
The recent need to monitor Java applications on Linux systems uses the tools included with JDK1.5 JPS (Java Virtual Machine process status Tool, a tool to view the state of the JVM process), Jstat (J Ava Virtual Machine Statistics monitoring Tool, running data monitoring tools) and JSTATD (Jstat daemon program, using RMI for remote monitoring). (It is recommended that you can use the Jvmstat package, visual jstat monitoring tools, can be downloaded in http://java.sun.com/performance/jvmstat/)

The deployment process is described as follows:

1. Deploy related applications on machines that need to be monitored (I am here as a Linux machine):

(a) Install JDK1.5 on the machine you need to monitor (crazy for a while), Don't fall down (this part doesn't say much, because if I have to explain it, I'm dizzy).

b correctly set up the Java runtime environment.

c) Start the JSTATD process.

The order is as follows:./jstatd-j-djava.security.policy=all.policy

Generally speaking, there is a problem here, that is the problem of permission, fortunately, Sun's website gives the relevant solution, the following method, in the Jdk/.../security/java.policy file to add the following code:

Grant codebase "file:${java.home}/." /lib/tools.jar "{

Permission java.security.AllPermission;

};

Then restart the JSTATD process.

D) It's over, don't let people move, I often accidentally press CTRL + C to shut down the program.

2. Operations on the client (the machine used by the monitor):

A use JPS to see which JVM processes are in use at the remote machine, as follows:

JPS 172.25.1.24//remote machine IP address or name

The screen input is as follows:

13686 JSTATD

14115 Xxxjavaserver

15117 Jserver

b The JSTATD process of the remote machine can be seen from above has been started. We can use Jstat to view the specific situation of the related process.

Jstat command usage is as follows:

Jstat-<option> [t] [-h<lines>] <vmid> [<interval> [<count>]]

Explained as follows:

Option includes the following options:

-class

-compiler

-gc

-gccapacity

-gccause

-gcnew

-gcnewcapacity

-gcold

-gcoldcapacity

-gcpermcapacity

-gcutil

-printcompilation

Vmid is JPS the process ID, such as the process ID on Jserver is 15117.

Interval is the time interval, in milliseconds, and 1000 for a second.

Count is the number of times you need to view it.

The example assumes that we need to see the 172.25.1.24 machine Vmid 15117 GC, you can enter the following command:

JSTAT-GC 15117@172.25.1.24 1000 3

Then you can see four lines of information (a behavior title, the rest is the information you want), a closer look will be able to find a lot of information (if you do not understand, you can ask me, 6-6).

c) then start to configure the visualization of the monitoring package, jvmstat, download the good, extract to any directory.

Perform VISUALGC, and then you can see the Visual Monitoring window. However, it appears that only the VISUALGC startup scripts under Linux are available, so it is best to use the following methods that I provide under Windows or Linux:

Under Linux:

/usr/java/jdk1.5/bin/java–xbootclasspath/p: "/usr/java/jdk1.5/lib/tools.jar" –jar Jvmstat/jars/visualgc.jar Vmid@server

As with Windows, it's better to change the path of the JDK.

After a successful execution you can see a Java Watch Window (which is quite professional) and you can start monitoring at this time.

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.