The thread profiling feature collects statistics on the CPU time per thread and the number of threads per type. This feature records and aggregates the method stacks of threads every 5 minutes. This helps you review the code execution process and identify thread problems. When the CPU utilization of a cluster is high or a large number of slow methods are detected, the thread profiling feature can be used to identify the thread or method that consumes the most CPU resources.

Procedure

  1. Log on to the EDAS console.
  2. Perform one of the following operations as needed to go to the application details page:
    • In the left-side navigation pane, choose Resource Management > Container Service Kubernetes Clusters or Resource Management > Serverless Kubernetes Clusters. In the top navigation bar, select a region. In the upper part of the page, select a namespace. On the Container Service Kubernetes Cluster or Serverless Kubernetes Clusters page, click a cluster ID. In the Applications section of the Cluster Details page, click the name of the application for which you want to view the details.
    • In the left-side navigation pane, click Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list and click the application name.
  3. In the left-side navigation pane of the application details page, choose Monitor > Application Diagnosis-Threads.

Perform thread profiling

On the Threads Profiling page, all threads of the application are listed on the left. You can detect abnormal threads based on statistics in the CPU Time Consumption (ms) section. Select an abnormal thread and analyze the changes of the CPU time consumption and thread count based on the graphs in the CPU Time Consumption (ms) and Thread Count sections. For example, you can analyze whether the total number of threads per minute is overlarge.

pg_am_threads_profiling

You can also click Method Stack to view the method stack that is actually running within a specified period of time. For example, you can view the method stack of the threads in the BLOCKED state and optimize the specified code block to reduce CPU utilization.

pg_am_method_stack