Have you encountered any of these problems?

  • The system performance is abnormal
  • Don’t know what tool to use when troubleshooting a problem
  • Finding tools, downloading and installing them can be a waste of time
  • Troubleshooting is very tedious, and we want to simplify the troubleshooting scheme as much as possible for subsequent use

XPocket is PerfMa’s open source plug-in container for solving performance problems. It adapates common Linux commands, JDK tools, and well-known performance tools to various XPocket plug-ins for locating or solving performance problems, and enables them to interact with each other to solve specific performance problems with one click.

XPocket plug-in ecosystem has realized the integration of HSDB, JDB, JConsole, Perf, Arthas and other excellent open source performance tools. XPocket supports JDK 8+, supports Linux/Mac/Windows, adopts command line interaction mode, provides rich Tab auto-complete function, supports pipeline operation.

The following is part of the official XPocket plug-in guide and real cases.

1.XPocket plugin jstack_x helps troubleshoot thread problems

Heapdumps. Cn/article / 249…

During program development, developers often encounter many online problems, which can be caused by code bugs or performance issues. These online problems can manifest themselves in the form of CPU spikes, GC spikes, OOM exceptions, etc. The root cause of these problems is likely to be thread or thread pool misuse. To locate the root cause as quickly as possible, you can use the JSTACK_X plug-in to start with threads.

The XPocket plugin jstack_x is an enhanced version of the JDK’s jStack tool. In addition to supporting the output of the Java stack and the local stack, the XPocket plugin jstack_X can also see the thread waiting or holding the lock from the perspective of the lock, and can filter out specific threads by thread name and NID.

In this article, jstack_x plug-in is used to check the skyrocketing CPU usage of threads, unintentionally create excessive threads, and a large number of threads waiting to acquire shared resources. XPocket jstack_x plug-in is enhanced on the original JStack tool of JDK. Helps every developer troubleshoot thread-related issues more quickly.

Plugin.xpocket.perfma.com/plugin/66 jstack_x plug-in download address

XPocket xpocket.perfma.com/docs/downlo download address…

2. Use the XPocket plug-in JConsole to check OOM exceptions

Heapdumps. Cn/article / 263…

The XPocket plug-in JConsole is mainly used to check memory problems. It can observe Eden, Survivor and Old areas in the heap as well as Metaspace and Code Cache areas outside the heap.

This article uses the JConsole plug-in to check OOM exceptions caused by frequent class loading and heap memory leakage. JConsole can check the usage of Java process memory, especially in the troubleshooting process, it needs to print several times and compare the value to find the problem. If you want to further locate problems at the code level, you can also use other plug-ins in XPocket to assist in locating problems.

JConsole plug-in download address

plugin.xpocket.perfma.com/plugin/55

3. Use the Perf plug-in to track process switchover information

Heapdumps. Cn/article / 264…

CPU usage is the most intuitive and commonly used system performance indicator. It is the first indicator to be paid attention to when troubleshooting performance problems. Process switching is also a common cause of high CPU usage. In the case of a large number of process context switches, it is easy to cause the CPU to spend a lot of time on saving and recovering resources such as registers, kernel stack and page table, so that the system performance cannot be fully utilized.

Perf plug-in itself can track the process switch call stack and make statistics. This article uses a simple example to verify the function of this plug-in.

In the case of abnormal system process switch times, you can use the Perf plug-in to check out specific functions.

Perf plug-in download address

plugin.xpocket.perfma.com/plugin/57

4. Use the Top_X plug-in to check memory overload

Heapdumps. Cn/article / 264…

The Top command is a common monitoring tool in Linux. It is used to obtain real-time CPU or memory usage at the process level.

Top_X in XPocket is an enhanced version of Linux Top, which can display the CPU usage/load, and the list of CPU and memory processes used. It is more clear and easy to use, support pipelining, especially can directly get the TOP process or thread TID, PID; The mem_s command is used to sort processes by swap size to enhance the original top function.

This paper simulates a machine memory leak that uses a large amount of physical memory, resulting in a physical memory surge.

You can use the Top_X plug-in to check memory usage when you encounter memory overload problems.

Top_X plug-in download address

plugin.xpocket.perfma.com/plugin/65

5. Use VJMap to troubleshoot frequent YGC problems

Heapdumps. Cn/article / 263…

The generational version of JMAP (New generation, living area, old generation) is a powerful tool for identifying the causes of slow memory leaks and old generation growth. Because jMAP-Histo PID prints object statistics for the entire Heap, in order to locate the problem of frequent YGC in the process, we need tools that specifically look at OldGen objects and older objects in Survivor zones.

This paper first used VJMap plug-in to check the memory usage of the young generation of frequent YGC processes, then combined with XElephant tool of HeapDump community to analyze dump files, and finally found the problem.

Plugin.xpocket.perfma.com/plugin/58 VJMap plug-in download address

XPocket xpocket.perfma.com/docs/downlo download address…