Performance optimization tools use -VisualVM

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.exeand double-click to open the can.

Here Insert Picture Description
Here Insert Picture Description

7.2, view the local process

Here Insert Picture Description

7.3, see the CPU, memory, classes, threads run information

Here Insert Picture Description

7.4, see the details thread

Here Insert Picture Description
Dump can also click on the top right button, the information is exported thread, in fact, jstack command execution.

Here Insert Picture Description
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.
Here Insert Picture Description

7.6, remote monitoring of jvm

VisualJVMNot 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:
Here Insert Picture Description
save and exit and restart tomcat.

7.6.3, using VisualJVM connect to a remote tomcat

Add Remote Host:
Here Insert Picture Description
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:

Here Insert Picture Description

Here Insert Picture Description

connection succeeded. To use the same methods as before, and you can monitor local jvm process, like tomcat monitoring process remotely.

Released 1056 original articles · won praise 888 · views 30000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/103986281