All Products
Search
Document Center

Application Real-Time Monitoring Service:Analyze errors in code by using the thread profiling feature

Last Updated:Jan 12, 2024

Thread profiling is a code-level diagnostics feature provided by Application Real-Time Monitoring Service (ARMS). It can automatically capture stack snapshots of slow calls and reproduce the code execution process.

Scenarios

Note

Only Application Monitoring Pro Edition supports thread profiling.

  • If slow calls occur on occasions such as promotional events, you can use the thread profiling feature to efficiently identify problematic code.

  • If large numbers of slow calls occur in your business system, you can use the thread profiling feature to analyze threads.

  • If occasional slow calls cannot recur due to business complexity, you can use the thread profiling feature to reproduce the code execution process.

Set thread profiling parameters

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

  2. On the Applications 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, click Application Settings. On the page that appears, click the Custom Configuration tab.

  4. In the Thread settings section, turn on or turn off Thread profiling total control switch and set the Slow call listen trigger threshold parameter.

    Note
    • The listener starts only when the response time of a service call exceeds the threshold, which is 2,000 milliseconds by default. The listening lasts until the call ends or the consumed time exceeds 15 seconds.

    • We recommend that you set the threshold to the 99th percentile of the call response time. For example, if 100 calls are listed in ascending order by response time, the time consumed by the 99th one is the 99th percentile.

    Thread Settings

  5. In the lower part of the tab, click Save.

View thread profiling details by calling API operations

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

  2. On the Applications 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, click Interface Invocation. On the page that appears, select the required API operation and click the Trace query tab.

  4. On the Trace query tab, click the required TraceId.

  5. Click the Magnifier icon in the Details column. Then, click the Thread Profiling tab.

    Thread analysis

    Note
    • The actual response time is the amount of time a service call consumes and is not affected by thread profiling.

    • The listening response time is the amount of time when thread profiling is effective. Generally, the listening response time is approximately the actual response time minus the listening threshold for slow calls.

View thread profiling details by using a trace query

  1. In the left-side navigation pane of the ARMS console, choose Application Monitoring > Invocation Trace Query.

  2. In the Parameter type drop-down list of the Trace Query page, select Only thread profiling snapshots are included and click Add to query criteria.

  3. In the query result, click the required TraceId.

  4. Click the Magnifier icon in the Details column. Then, click the Thread Profiling tab.

FAQ

  • Q: What is the actual response time?

    A: The actual response time is the amount of time a service call consumes and is not affected by thread profiling.

  • Q: What is the listening response time?

    A: The listening response time is the amount of time when thread profiling is effective. To minimize listening pressure, thread profiling listens only to the range of execution time that exceeds the listening threshold of slow calls. The default threshold is 2 seconds. If a slow call consumes 5 seconds, thread profiling listens to only the time range between the third and fifth second. If a call consumes 1.8 seconds, thread profiling does not listen to the call.

  • Q: Why is the listening response time shorter than the actual response time? Why does the listener miss some slow calls that exceed the listening threshold?

    A:

    • Thread profiling listens only to the range of execution time that exceeds the listening threshold of slow calls. Typically, the listening response time is approximately the actual response time minus the listening threshold for slow calls.

    • If the system has a large number of slow calls at the same time, the listener may miss specific slow calls after the listening threshold is exceeded because the number of listening threads is limited. In this case, the listening response time is shorter than the actual response time and the listener may miss calls.

    • To ensure that slow calls that exceed 5 seconds are listened to, thread profiling configures independent listening threads for these slow calls. In this case, the listening response time is approximately the actual response time minus 5 seconds.