Which Java thread is hogging the CPU?

前端 未结 12 1749
萌比男神i
萌比男神i 2020-12-07 07:48

Let\'s say your Java program is taking 100% CPU. It has 50 threads. You need to find which thread is guilty. I have not found a tool that can help. Currently I use the follo

12条回答
  •  再見小時候
    2020-12-07 08:23

    I would recommend taking a look at Arthas tool open sourced by Alibaba.

    It contains a bunch of useful commands that can help you debug your production code:

    • Dashboard: Overview of Your Java Process
    • SC: Search Class Loaded by Your JVM
    • Jad: Decompile Class Into Source Code
    • Watch: View Method Invocation Input and Results
    • Trace: Find the Bottleneck of Your Method Invocation
    • Monitor: View Method Invocation Statistics
    • Stack: View Call Stack of the Method
    • Tt: Time Tunnel of Method Invocations

    Example of the dashboard:

提交回复
热议问题