All Products
Search
Document Center

Application Real-Time Monitoring Service:Use thread profiling

Last Updated:Mar 11, 2026

Thread profiling provides statistics on CPU time consumption at the thread level and the number of threads per type. When the CPU utilization of a cluster is high or a large number of slow methods are detected, thread profiling helps you trace the problem to specific threads and methods. ARMS records and aggregates method stacks every 5 minutes, giving you a time-series view of which code paths consume the most resources.

Prerequisites

  • Your application is connected to ARMS Application Monitoring. For setup instructions, see the quick start guide for your language (Java, Go, or Python).

  • Method stack data requires additional configuration depending on your ARMS agent version:

    ARMS agent versionRequired setting
    Earlier than 2.7.3.5Turn on Thread Profiling Method Stack in Application Settings > Custom Configuration > Thread Settings. For details, see the "Enable method stack collection" section below.
    2.7.3.5 or laterTurn on both Main switch and CPU hotspot in Application Settings > Custom Configuration > Continuous profiling. For details, see the "Enable method stack collection" section below.

Open the thread profiling page

  1. Log on to the ARMS console.

  2. In the left-side navigation pane, choose Application Monitoring > Application List.

  3. On the Application List page, select a region in the top navigation bar, then click the name of the application.

    Note Icons in the Language column indicate the application language: - Java图标: Java - image: Go - image: Python - Hyphen (-): application monitored through Managed Service for OpenTelemetry.
  4. In the left-side navigation pane, choose Application Diagnosis > Threads Profiling.

Identify CPU hotspots

The Threads Profiling page lists all threads in the left panel with their CPU Time Consumption (ms) values. The value represents the total CPU time that a thread consumed during each 5-minute sampling window.

Thread profiling overview

To find the threads responsible for high CPU usage:

  1. Sort or scan the thread list by CPU Time Consumption (ms). Focus on threads with values significantly higher than others.

  2. Select a thread to view its CPU Time Consumption (ms) and Thread Count time-series graphs. For example, you can analyze whether the total number of threads per minute is overlarge.

  3. Look for these common patterns:

    PatternLikely causeRecommended action
    Sustained high CPU time on a single threadInefficient loop, heavy computation, or regex backtrackingInspect the method stack to identify the hot method
    Sudden spike in thread countThread pool sized too large, or thread leakCheck thread pool configuration and whether threads are properly returned
    Multiple threads with similar CPU timeLock contention or redundant parallel workFilter by BLOCKED state and review the contending lock
    CPU time increases after a deploymentPerformance regression in new codeCompare method stacks before and after the deployment using the time picker

Inspect method stacks

Click Method Stack to view the call stack captured during a specific time window. The method stack shows which code paths consumed CPU time or caused threads to block.

Method stack view

Example: reduce CPU caused by lock contention

  1. Filter threads by the BLOCKED state.

  2. Open the method stack for a blocked thread.

  3. Identify the code block that holds the lock, then optimize it -- for example, reduce the scope of the synchronized block or switch to a concurrent data structure.

Continuous profiling (ARMS agent 2.7.3.5 or later)

If your ARMS agent version is 2.7.3.5 or later, continuous profiling provides more accurate information about the method stacks and CPU utilization of threads.

Continuous profiling view

For details, see Use the CPU and memory diagnostics feature.

Enable method stack collection

If no data appears when you click Method Stack, method stack collection is not enabled. Follow the steps for your ARMS agent version:

ARMS agent earlier than 2.7.3.5

  1. In the left-side navigation pane of the application, click Application Settings.

  2. Click the Custom Configuration tab.

  3. In the Thread Settings section, turn on Thread Profiling Method Stack. After you turn on this switch, ARMS collects method stack data every 5 minutes.

ARMS agent 2.7.3.5 or later

  1. In the left-side navigation pane of the application, click Application Settings.

  2. Click the Custom Configuration tab.

  3. In the Continuous profiling section, turn on both Main switch and CPU hotspot.

Correlate with other diagnostic tools

Thread profiling is most effective when combined with other ARMS diagnostic features:

  • Trace correlation: Cross-reference thread profiling data with slow traces in Application Diagnosis > Trace Query to connect high CPU consumption to specific requests.

  • Deployment comparison: Use the time picker on the Threads Profiling page to compare CPU consumption before and after a deployment to identify performance regressions.

  • Continuous profiling upgrade: For ARMS agent 2.7.3.5 or later, CPU and memory diagnostics provides more accurate method stacks and CPU utilization data beyond what thread profiling offers.