7, using VisualVM tool
The VisualVM , can monitor the thread, where memory, CPU time, memory and object view approach, an object has been GC reverse view of stack allocation (e.g., a String object 100 which are allocated by the several objects out).
VisualVM simple, almost 0 configuration, function quite rich, including almost all the features of JDK comes with other commands.
- Memory Information
- Thread Information
- Dump the heap (local processes)
- Dump thread (local processes)
- Open heap Dump. Dump jmap stack can be generated. Open Thread Dump
- Generation application snapshot (contains memory information, thread information, etc.)
- Analysis of performance. CPU analysis (each method call time, which methods are time-consuming checking), analyze memory (memory occupied by all kinds of objects, check what classes take up much memory)
- ……
7.1, start
Jdk bin directory in the installation directory, locate jvisualvm.exe
and double-click to open the can.
7.2, view the local process
7.3, see the CPU, memory, classes, threads run information
7.4, see the details thread
Dump can also click on the top right button, the information is exported thread, in fact, jstack command execution.
Found that the content displayed is the same.
7.5 sampler
Sampling may be CPU, memory are sampled over a period of time for analysis.
7.6, remote monitoring of jvm
VisualJVM
Not only can monitor local jvm process, can also monitor remote jvm process, need the help of JMX technology.
7.6.1 What is JMX?
JMX(Java Management Extensions,即Java管理扩展)
It is a management function for implant applications, devices, systems, and other frameworks. JMX across a range of heterogeneous operating system platform, system architecture and network transport protocols, flexible development seamlessly integrated system, network and service management applications.
7.6.2, remote monitoring of tomcat
Want to monitor remote tomcat, you need to be in a remote JMX configuration tomcat, as follows:
save and exit and restart tomcat.
7.6.3, using VisualJVM connect to a remote tomcat
Add Remote Host:
In a host may have a lot of jvm need to be monitored, so the next step is to add the jvm need to be monitored on the host:
connection succeeded. To use the same methods as before, and you can monitor local jvm process, like tomcat monitoring process remotely.