Rate This Document
Findability
Accuracy
Completeness
Readability

Introduction

The Java Profiler is a performance analysis and tuning tool for Java programs running on Kunpeng-powered servers. It displays information about the heaps, threads, locks, and garbage collection (GC) of Java programs in graphics, collects information about hotspot functions, and helps locate program bottlenecks.

  • The Java Profiler is started based on the JDK. You are advised to deploy the Kunpeng DevKit only in development environments for security purposes.
  • The Kunpeng DevKit installed in a container does not support the Java Profiler VS Code plugin.
Table 1 Task description

Task Type

Description

Real-time profiling

The tool analyzes the target Java virtual machine (JVM) and Java programs. Specifically, the tool analyzes the heap, GC activities, thread status, and performance of upper-layer Java programs, and provides information such as call chain analysis results, hotspot functions, lock analysis results, program thread status, and object distribution. The JVM running data is obtained in real time using the agent for precise analysis.

The analysis results include the following content:

  1. Overview
    • Real-time display of the JVM system status.
    • Real-time display of the JVM information, including the heap size, GC activities, number of threads, number of loaded classes, and CPU usage.
  2. Thread information

    Displays the real-time active thread status and current thread dump in the JVM, displays the thread lock status in graphics, and analyzes the thread deadlock.

  3. Memory information
    • By capturing heap snapshots, the tool analyzes the heap histogram distribution and dominator tree of an application at a certain point of time and traces the reference relationship chain from each Java object in the heap memory to the GC root, helping locate potential memory problems. The tool compares and analyzes heap snapshots at different points of time, and analyzes the changes of heap usage and allocation, helping to detect exceptions.
    • Obtains the quantity and sizes of objects created in the Java heap and displays the memory usage in real time.
  4. Hotspot information
    • Hotspot methods analyzed by the tool are displayed in icicle graphs. Hotspot methods at different layers (such as the Java call layer, JNI layer, Native layer, and kernel layer) are distinguished by different colors.
    • You can look into details about the bytecode (optional) of the Java method, machine instructions generated by the JVM JIT compiler, and hotspot distribution of these instructions. Reasons are provided if the bytecode cannot be viewed.
    • The tool also collects call chains of specified entry methods as well as data such as method calling relationships and time consumption during the sampling period. These are displayed in a tree chart.
  5. GC information

    You can collect and analyze GC events in the target JVM process in real time and analyze factors such as GC causes, phases, performance, and pauses to locate potential GC-related memory issues and performance bottlenecks.

  6. I/O information

    Analyzes the file I/O, socket I/O latency, and consumed bandwidth of an application in real time to identify hotspot I/O operations.

  7. Database information
    • Monitors and analyzes database connection pools. It monitors connections in a database connection pool, helping locate potential connection leaks and providing tuning suggestions for improper connection pool configurations.
    • Analyzes hotspot SQL operations of Java database connectivity (JDBC). It records the SQL call time, duration, and stack tracing in applications, helping locate the hotspot SQL operation that takes the longest time.
    • Analyzes hotspot NoSQL operations. It records the NoSQL call time, duration, and stack tracing in applications, helping locate the hotspot NoSQL operation that takes the longest time.
  8. HTTP information

    Records the time and duration of HTTP requests in applications and identifies hotspot HTTP requests.

  9. Snapshot information

    Snapshots can be generated during real-time analysis of heap, I/O, and workload data. By comparing snapshots, the tool helps to detect the trends of resource and service metrics and to identify potential risks on resource leak or performance deterioration.

Sampling profiling

The tool collects internal activities and performance events of the JVM through data sampling, and performs offline analysis through data recording and playback. This method requires only a small overhead and has little impact on services, making it suitable for large Java programs.

The analysis results include the following content:

  1. Overview
    • JVM system status.
    • Sampling and playback of recorded JVM information, including the heap usage, GC activities, I/O consumption, and CPU usage.
  2. Thread dump and lock analysis results
    • Analyzes the thread status and locks of programs. It obtains the thread status changes and current thread dump within the sampling time, displays the thread lock status in graphics based on the thread dump, and analyzes thread deadlocks.
    • Analyzes and estimates the thread block objects and block time.
  3. Method sampling analysis results
    • Analyzes the CPU cycle proportion and location of hotspot functions in Java and native code.
    • Displays hotspot functions and their call stacks in a flame graph.
  4. Memory analysis results
    • Displays allocation of Java objects in the heap, helping to detect potential problems by quickly locating the objects that consume the most heap resources or that are allocated the most heap resources. The tool uses stack trace to locate potential memory problems.
    • By sampling Java objects with a long retention period, you can identify potential heap memory leaks in Java applications and locate possible causes.
  5. GC analysis results

    Displays the Java GC configuration, heap size changes, and GC event occurrence. You can analyze and adjust the current GC policy by observing the heap changes, GC activity frequency, and pause time.

  6. I/O analysis results

    The tool analyzes the file read/write statistics and socket traffic usage of the target Java application to detect I/O performance bottlenecks. You can also analyze the application's read/write statistics on files, including the read/write path, read/write frequency, read/write rate, total read/write amount, stack tracing (configurable), and time-based change graph.

Use Restrictions

Table 2 Use restrictions

Task Type

Description

Real-time profiling

  • The JDK version must be JDK 8 or later.
  • If the server does not support hotspot analysis, the Create Hotspot Analysis button is unavailable.
  • Currently, Concurrent Mark Sweep (CMS) and Garbage-First (G1) garbage collector logs can be parsed. Java 8 supports CMS and G1, whereas Java 9 and later versions support only G1.
  • Each user can perform real-time profiling on a maximum of 10 processes at the same time.

Sampling profiling

The JDK that runs the Java process must be BiSheng JDK 8.302 or later or OpenJDK 9 or later.