All Products
Search
Document Center

Application Real-Time Monitoring Service:Thread profiling

Last Updated:Jul 04, 2024

The thread profiling feature provides statistics on the CPU time consumption at the thread level and the number of threads per type. ARMS records and aggregates the method stacks of threads every 5 minutes. This helps you review the code execution process and identify thread issues. 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 find out the threads or methods that consume the most CPU resources.

Procedure

  1. Log on to the ARMS console. In the left-side navigation pane, choose Application Monitoring > Application List.

  2. On the Application List page, select a region in the top navigation bar and click the name of the application that you want to manage.

    Note

    If the Java图标 icon is displayed in the Language column, the application is connected to Application Monitoring. If a hyphen (-) is displayed, the application is connected to Managed Service for OpenTelemetry.

  3. In the left-side navigation pane, choose Application Diagnosis > Threads Profiling.

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 graphs for CPU Time Consumption (ms) and Thread Count. 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 running within a specified period of time. For example, by viewing the method stack of the threads in the BLOCKED state, you can optimize the specified code block to reduce CPU utilization.

pg_am_method_stack

If the version of the ARMS agent is 2.7.3.5 or later, the continuous profiling feature provides more accurate information about the method stacks and CPU utilization of threads, as shown in the following figure. For more information, see Use the CPU and memory diagnostics feature.

image

Note

If no data is displayed after you click Method Stack, perform the following steps to troubleshoot the problem:

  • If the version of the ARMS agent is earlier than 2.7.3.5, click Application Settings in the left-side navigation pane of the application details page. On the page that appears, click the Custom Configuration tab and check whether Thread Profiling Method Stack in the Thread Settings section is turned on. If the switch is turned off, method stack information cannot be recorded. If the switch is turned on, method stack information is collected every 5 minutes.

  • If the version of the ARMS agent is 2.7.3.5 or later, click Application Settings in the left-side navigation pane of the application details page. On the page that appears, click the Custom Configuration tab and check whether Main switch and CPU hotspot in the Continuous profiling section are turned on. If the switches are turned off, method stack information cannot be recorded. If the switches are turned off, method stack information cannot be recorded.