You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/java-perf-flamegraph/1_setup.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,17 @@ layout: learningpathall
7
7
---
8
8
9
9
10
-
## Before You Begin
11
-
-There are numerous performance analysis methods and tools for Java applications, among which the call stack flame graph method is regarded as a conventional entry-level approach. Therefore, generating flame graphs is considered a basic operation.
12
-
-Various methods and tools are available for generating Java flame graphs, including `async-profiler`, `Java Agent`, `jstack`, `JFR` (Java Flight Recorder), etc.
13
-
-This Learning Path focuses on introducing two simple and easy-to-use methods: `async-profiler` and `Java Agent`.
10
+
## Overview
11
+
There are numerous performance analysis methods and tools for Java applications, among which the call stack flame graph method is regarded as a conventional entry-level approach. Therefore, generating flame graphs is considered a basic operation.
12
+
Various methods and tools are available for generating Java flame graphs, including `async-profiler`, `Java Agent`, `jstack`, `JFR` (Java Flight Recorder), etc.
13
+
This Learning Path focuses on introducing two simple and easy-to-use methods: `async-profiler` and `Java Agent`.
14
14
15
15
16
16
## Setup Benchmark Server - Tomcat
17
17
-[Apache Tomcat](https://tomcat.apache.org/) is an open-source Java Servlet container that enables running Java web applications, handling HTTP requests and serving dynamic content.
18
18
- As a core component in Java web development, Apache Tomcat supports Servlet, JSP, and WebSocket technologies, providing a lightweight runtime environment for web apps.
19
19
20
-
1. Start by installing Java Development Kit (JDK) on your Arm-based server:
20
+
1. Start by installing Java Development Kit (JDK) on your Arm-based server running Ubuntu:
21
21
```bash
22
22
sudo apt update
23
23
sudo apt install -y openjdk-21-jdk
@@ -31,13 +31,13 @@ tar xzf apache-tomcat-11.0.9.tar.gz
31
31
32
32
3. If you intend to access the built-in examples of Tomcat via an intranet IP or even an external IP, you need to modify a configuration file as shown:
33
33
```bash
34
-
vim apache-tomcat-11.0.9/webapps/examples/META-INF/context.xml
34
+
vi apache-tomcat-11.0.9/webapps/examples/META-INF/context.xml
35
35
```
36
-
Then change the values:
37
-
```console
36
+
Then change the allow value as shown and save the changes:
`wrk2` is a high-performance HTTP benchmarking tool specialized in generating constant throughput loads and measuring latency percentiles for web services. `wrk2` is an enhanced version of `wrk` that provides accurate latency statistics under controlled request rates, ideal for performance testing of HTTP servers.
67
69
70
+
Currently `wrk2` is only supported on x86 machines. You will run the Benchmark Client steps shown below on an x86_64 server running Ubuntu.
71
+
72
+
68
73
1. To use `wrk2`, you will need to install some essential tools before you can build it:
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/java-perf-flamegraph/2_async-profiler.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ weight: 3
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Java Flame Graph Generation via async-profiler [async-profiler](https://github.com/async-profiler/async-profiler) (Recommended)
10
-
-async-profiler is a low-overhead sampling profiler for JVM applications, capable of capturing CPU, allocation, and lock events to generate actionable performance insights.
11
-
-A lightweight tool for Java performance analysis, async-profiler produces flame graphs and detailed stack traces with minimal runtime impact, suitable for production environments.
9
+
## Java Flame Graph Generation using [async-profiler](https://github.com/async-profiler/async-profiler)
10
+
`async-profiler` is a low-overhead sampling profiler for JVM applications, capable of capturing CPU, allocation, and lock events to generate actionable performance insights.
11
+
A lightweight tool for Java performance analysis, `async-profiler` produces flame graphs and detailed stack traces with minimal runtime impact, suitable for production environments. In this section, you will learn how to install and use it to profile your Tomcat instance being benchmarked.
12
12
13
-
You should deploy async-profiler on the same machine where Tomcat is running to ensure accurate performance profiling.
13
+
You should deploy `async-profiler` on the same Arm Linux machine where Tomcat is running to ensure accurate performance profiling.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/java-perf-flamegraph/3_agent.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,32 +7,42 @@ weight: 4
7
7
layout: learningpathall
8
8
---
9
9
10
-
## Java Flame Graph Generation via Java agent and perf
11
-
To profile a Java application with perf and ensure proper symbol resolution, you must include libperf-jvmti.so when launching the Java application.
12
-
- libperf-jvmti.so is a JVM TI agent library enabling perf to resolve Java symbols, facilitating accurate profiling of Java applications.
13
-
- A specialized shared library, libperf-jvmti.so bridges perf and the JVM, enabling proper translation of memory addresses to Java method names during profiling.
10
+
## Java Flame Graph Generation using Java agent and perf
11
+
To profile a Java application with perf and ensure proper symbol resolution, you must include `libperf-jvmti.so` when launching the Java application.
12
+
-`libperf-jvmti.so` is a JVM TI agent library enabling perf to resolve Java symbols, facilitating accurate profiling of Java applications.
13
+
- A specialized shared library, `libperf-jvmti.so` bridges perf and the JVM, enabling proper translation of memory addresses to Java method names during profiling.
14
14
15
-
1. Find and add libperf-jvmti.so to Java option
15
+
1. Find where `libperf-jvmti.so` is installed on your Arm-based Linux server:
16
+
```bash
17
+
pushd /usr/lib
18
+
find . -name libperf-jvmti.so`
19
+
```
20
+
The output will show the path of the library that you will then include in your Tomcat setup file:
Add JAVA_OPTS="$JAVA_OPTS -agentpath:/usr/lib/linux-tools-6.8.0-63/libperf-jvmti.so -XX:+PreserveFramePointer" to `catalina.sh`. Make sure the path matches the location on your machine from the previous step.
25
+
26
+
Now shutdown and restart Tomcat:
27
+
```bash
19
28
cd apache-tomcat-11.0.9/bin
20
29
./shutdown.sh
21
30
./startup.sh
22
31
```
23
32
24
-
2. Use perf to profile Tomcat, and restart wrk if necessary
33
+
2. Use perf to profile Tomcat, and restart wrk that running on your x86 instance if necessary:
0 commit comments