1. Overview

Java Sampling Profilers are usually designed using the JVM Tool Interface (JVMTI) and collect stack traces at a safepoint. Therefore, these sampling profilers can suffer from the safepoint bias problem.

For a holistic view of the application, we need a sampling profiler that doesn’t require threads to be at safepoints and can collect the stack traces at any time to avoid the safepoint bias problem.

In this tutorial, we’ll explore async-profiler along with various profiling techniques it offers.

2. async-profiler

async-profiler is a sampling profiler for any JDK based on the HotSpot JVM. It has low overhead and doesn’t rely on JVMTI.

It avoids the safepoint bias problem by using the AsyncGetCallTrace API provided by HotSpot JVM to profile the Java code paths, and Linux’s perf_events to profile the native code paths.

In other words, the profiler matches call stacks of both Java code and native code paths to produce accurate results.

#ide #java #debugging #intellij

A Guide to async-profiler
9.50 GEEK