All Products
Search
Document Center

Application Real-Time Monitoring Service:Arthas diagnostics

Last Updated:Oct 12, 2024

Arthas helps developers diagnose issues in the production environments of Java applications. It adopts the bytecode enhancement technology and allows developers to troubleshoot applications without restarting running Java virtual machine (JVM) processes.

Application Real-Time Monitoring Service (ARMS) is completely integrated with all the capabilities of Arthas. Compared with mounting Arthas, the integrated Arthas capabilities of ARMS have the following advantages:

  • The Arthas capabilities do not depend on a Java Development Kit (JDK) environment. You do not need to download and install Arthas. You can enable or disable the capabilities at a time based on your business requirements.

  • The main features are accessible by browser. You do not need to specify commands or expressions.

  • The Arthas capabilities are connected to the ARMS context. You can run the trace command to view the trace IDs of ARMS.

Prerequisites

Note
  • Arthas is supported only in Application Monitoring Pro Edition.

  • We recommend that you enable Arthas only during troubleshooting.

  • The version of the ARMS agent is 2.7.1.3 or later.

  • The data of your application is imported to Application Monitoring. For more information, see Overview.

  • The application is developed in Java.

Background information

ARMS is integrated with the following real-time diagnostics capabilities of Arthas:

  • JVM overview: allows you to view the real-time memory usage, system information, system variables, and environment variables of a JVM process.

  • Thread analysis: allows you to view the time consumption of threads and the real-time method stack of a specified thread in a JVM process.

  • Method execution analysis: captures an execution record of any non-JDK method that meets specified conditions, and records the parameters, exceptions, returned values, and execution duration of each internal method.

  • Object viewer: allows you to view the real-time property values of an instance of any class.

  • Real-time dashboard: allows you to view the real-time information about common components. For example, you can view the configurations, usage, and the time consumption of SQL queries in a Druid connection pool.

  • Arthas Shell: allows you to perform Arthas diagnostics by using a command-line interface (CLI).

Note

Arthas performance analysis has been fully upgraded to the continuous profiling feature, which is more user-friendly and more powerful, and can be routinely enabled and used at any time.

The continuous profiling feature can effectively discover bottlenecks caused by CPU, memory, or I/O in Java programs, and display statistics data by method name, class name, and line number. This helps developers optimize programs, reduce latency, increase throughput, and save costs. For more information, see Use the continuous profiling feature.

Enable Arthas

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

  4. In the Arthas monitoring section of the Custom Configuration tab, turn on Arthas switch. You can also specify the IP addresses on which you want to perform Arthas diagnostics.

    自定义配置-Arthas监控

  5. On the Custom Configuration tab, click Save.

View diagnostics results

  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 > Arthas Diagnosis.

  4. On the Arthas Diagnosis page, select the application instance on which you want to perform diagnostics from the drop-down list on the top.

    • If the ARMS agent installed in the instance is earlier than V2.7.1.3, you are instructed to update the agent.

    • If the ARMS agent installed in the instance is V2.7.1.3 or later, the page displays the instance information provided by Arthas.

JVM overview

On the JVM overview tab, you can view the JVM information about the application, including the statistics on JVM memory and the information about the operating system and variables.

By default, when you enter the Arthas Diagnosis page, the JVM overview tab is displayed. The JVM overview tab contains the following sections:

  • JVM memory: displays information about JVM memory, such as the usage of heap memory and non-heap memory, and the information about garbage collection (GC).JVM内存

  • Operating system information: displays information about the operating system, such as the average system load, the name and version of the operating system, and the Java version.操作系统信息

  • Variable information: displays information about system variables and environment variables.变量信息

Thread duration analysis

On the Thread time-consuming analysis tab, you can view all the threads of the application and the stack information about each thread. The information on this tab helps you easily identify time-consuming threads.

  1. On the Arthas Diagnosis page, click the Thread time-consuming analysis tab.

    You can view the time consumption of threads in a JVM process on the Thread time-consuming analysis tab. Similar threads are displayed in one row as a category.新版Arthas诊断-线程耗时分析

  2. Click the + icon on the left side of a thread category name to view the details of all threads under this category, including the thread ID, CPU usage, and status.

  3. Click View the live stack in the Actions column of a thread to view the stack information about the thread.

    堆栈详情

Method execution analysis

On the Method execution analysis tab, you can view the information such as time consumption, input parameters, and returned values of a method, and even drill down to an internal method. You can use this information to locate the root causes of slow calls and missing logs, or troubleshoot non-reproducible issues.

  1. On the Arthas Diagnosis page, click the Method execution analysis tab.

  2. On the Method execution analysis tab, enter a keyword of the class name in the search box, and then click the 搜索 icon.

  3. Find the class on which you want to perform diagnostics from the displayed classes. Select a method of the class in the drop-down list on the right side and then click OK.

    ARMS captures a random execution record of the method. The execution information is displayed.新版Arthas诊断-方法执行分析

    • The internal execution records of the method that you select are displayed in the Execution Stack section on the left side.

      • To drill down to an internal method, find the internal method and click Drill in in the Actions column.

      • To view the source code of the method, click View Source Code next to Execution Stack.

        The execution duration of each internal method is displayed in the annotations of the source code.

    • The Method Execution Result section on the right side shows the parameter values, returned values, exceptions, member variables, and trace ID of the method.

    • In the Set Execution Conditions section on the right side, perform the following steps to set conditions for capturing a method execution record.

      1. Select a reload method from the drop-down list.

      2. In the Select Initial Filter Key drop-down list, select a key type that you want to specify first and click the 向左箭头 icon.

        Key types:

        • params[n]: the nth parameter of the method.

        • returnObj: the returned value of the method.

        • Method execution duration: the duration of the method.

        • Exception thrown or not: specifies whether an exception is thrown during the method execution.

        Note

        If a nested key is selected, you need to continue specifying the field of the nested key until a base field is selected.

      3. Select a condition.

      4. Enter a value.

      5. Click Add.

        The conditions for selecting the method execution records are displayed in the Current Filtering Conditions section.

        设置执行条件

      6. In the upper-right corner of the Execution Stack section, click the 刷新 icon. The system then captures the method execution records based on the specified conditions.

Object viewer

On the objectViewer tab, you can view information of some singleton objects to troubleshoot application exceptions, such as configuration errors, improper items in blacklists or whitelists, and abnormal status of member variables.

  1. On the Arthas Diagnosis page, click the objectViewer tab.

  2. On the objectViewer tab, enter a keyword of the class name in the search box and click the Search icon.

  3. Select the class on which you want to perform diagnostics from the displayed classes, select an instance of the class in the right-side pane, and then click OK.

    The real-time field values of the instance are displayed.Arthas诊断-对象查看器

    • The value of a simple field is displayed in the Details column in the Real-time Field Values of Object section on the left side.

    • To view the value of a complex field, click View Details in the Details column of the Real-time Field Values of Object section on the left side. The detailed field value is displayed in the Field Details section on the right side.

      Only part of the complex field value can be deserialized and displayed in the Field Details section. To view more data, click the click hyperlink in the parentheses next to Details.

Real-time dashboard

On the Real-time board tab, you can view the real-time information about key components in use, such as the usage of the database connection pool and the usage of the HTTP connection pool. The information helps you locate resource issues.

  1. On the Arthas Diagnosis page, click the Real-time board tab.

  2. On the Real-time board tab, select a dashboard from the drop-down list, select an instance of the dashboard, and click Add to board.

    The real-time information about a component is displayed. The following figure shows the real-time information about a Druid connection pool, including the basic configurations, connection pool status, and execution duration.Arthas诊断-实时看板

Arthas Shell

You can perform Arthas diagnostics by using a CLI.

Arthas Shell