Skip to content

Commit fd6cfa4

Browse files
committed
docs: update README to enhance clarity and add usage instructions for Tomcat and WildFly
1 parent 6a75b50 commit fd6cfa4

File tree

2 files changed

+67
-72
lines changed

2 files changed

+67
-72
lines changed

README.md

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,103 @@
1-
# Java Performance Agent – Introduction
1+
# Java Performance Agent
22

3-
## Overview
3+
## Introduction
4+
Java Performance Agent is a lightweight, pluggable Java agent designed to monitor, trace, and analyze the performance of Java applications in real time. It provides actionable insights into method execution times, call stacks, and resource usage, helping to identify bottlenecks and optimize application performance.
45

5-
Java Performance Agent is a lightweight, pluggable Java agent designed to monitor, trace, and analyze the performance of Java applications in real time. It provides developers and operators with actionable insights into method execution times, call stacks, and resource usage, helping to identify bottlenecks and optimize application performance.
6+
## Overview
7+
Enables real-time performance monitoring and tracing for Java applications, helping to identify bottlenecks and optimize code execution.
68

79
## Architecture
8-
9-
The agent consists of several key components:
1010
- **AgentEntrypoint & AgentInitializer**: Bootstrap and configure the agent at JVM startup.
1111
- **AgentStarter & AgentStarterImpl**: Manage the lifecycle and instrumentation logic.
1212
- **PerformanceTracer & TimerContext**: Collect and aggregate timing data for instrumented methods.
13-
- **Instrumentation via ByteBuddy**: The agent uses ByteBuddy to dynamically instrument classes and methods at runtime, enabling precise and flexible performance tracing without modifying application code.
13+
- **Instrumentation via ByteBuddy**: Uses ByteBuddy to dynamically instrument classes and methods at runtime, enabling precise and flexible performance tracing without modifying application code.
1414
- **ManagementHttpServer**: Embedded HTTP server exposing REST APIs and a web interface for trace management and visualization.
1515
- **Handlers (GetTrace, GetTraces, DeleteTrace, StopTrace, etc.)**: REST endpoints for trace operations (start, stop, list, download, delete).
1616
- **StaticResourceHandler**: Serves the web UI (HTML, CSS, JS) for interactive trace exploration.
1717
- **File Writers & Utilities**: Serialize, compress, and store trace data efficiently.
1818

19-
## How It Works
19+
## Requirements
20+
- Java 17+ (compatible with modern JVMs)
21+
- Works with Tomcat, WildFly, and other servlet containers
22+
- No code changes required in the target application
2023

21-
1. **Startup**: The agent is attached to the JVM (via `-javaagent`), initializing its configuration and HTTP server.
22-
2. **Instrumentation**: Classes and methods are instrumented based on filters and configuration, enabling precise timing and call tracking.
23-
3. **Trace Collection**: When a trace is started (via API or UI), the agent records method execution data and call stacks.
24-
4. **Trace Management**: Traces can be listed, downloaded, deleted, or stopped via REST API or the web interface.
25-
5. **Analysis**: Collected traces are available for download and analysis, helping to pinpoint performance issues.
24+
## Third-party Libraries & Docker Images
25+
This project uses [ByteBuddy](https://bytebuddy.net/) for runtime instrumentation of Java classes and methods.
26+
- ByteBuddy is licensed under the Apache License, Version 2.0. [License](https://www.apache.org/licenses/LICENSE-2.0)
27+
- By using ByteBuddy, this project complies with the terms of the Apache License 2.0, including attribution and license notice.
2628

27-
## Usage & Integration
29+
This project uses official Docker images for:
30+
- [Apache Tomcat](https://hub.docker.com/_/tomcat) (Apache License 2.0) [License](https://www.apache.org/licenses/LICENSE-2.0)
31+
- [Wildfly](https://hub.docker.com/r/jboss/wildfly) (LGPL v2.1) [License](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)
32+
33+
By using these images, you accept the terms of their respective licenses.
2834

35+
## Usage & Integration
2936
- **Attach to JVM**: Add the agent JAR to your JVM startup parameters:
3037
```sh
31-
-javaagent:/path/to/performance-agent.jar
38+
-javaagent:/path/to/performance-agent.jar -Dcmdev.profiler.filters.path=/path/to/filters.properties
3239
```
3340
- **Configure Filters**: Use `filters.properties` to specify which classes/methods to instrument.
3441
- **Access Web UI**: Open the embedded HTTP server (default port 8090) to interact with traces and view results.
3542
- **API Endpoints**: The REST endpoints are primarily called by the web UI for trace management and visualization, but are also available for automation and integration with CI/CD or monitoring tools.
3643

44+
## How It Works
45+
1. **Startup**: The agent is attached to the JVM (via `-javaagent`), initializing its configuration and HTTP server.
46+
2. **Instrumentation**: Classes and methods are instrumented based on filters and configuration, enabling precise timing and call tracking.
47+
3. **Trace Collection**: When a trace is started (via API or UI), the agent records method execution data and call stacks.
48+
4. **Trace Management**: Traces can be listed, downloaded, deleted, or stopped via REST API or the web interface.
49+
5. **Analysis**: Collected traces are available for download and analysis, helping to pinpoint performance issues.
50+
3751
## Example REST Endpoints
3852
- `GET /traces` – List available traces
3953
- `POST /trace/start` – Start a new trace
4054
- `POST /trace/stop` – Stop the current trace
4155
- `GET /trace/{id}` – Download a trace file
4256
- `DELETE /trace/{id}` – Delete a trace
4357

44-
## Requirements
45-
- Java 17+ (compatible with modern JVMs)
46-
- Works with Tomcat, WildFly, and other servlet containers
47-
- No code changes required in the target application
48-
4958
## Quick Start
5059
1. Build the agent and your target application.
5160
2. Start your application with the agent attached.
5261
3. Access the web UI or use the REST API to manage and analyze traces.
5362

63+
## How to Start
64+
To run and test the Performance Agent with Tomcat or Wildfly, follow these steps:
65+
66+
### Tomcat 10.0 jdk17
67+
```bash
68+
export MSYS_NO_PATHCONV=1
69+
JAVA_TOOL_OPTIONS="-XX:-UseContainerSupport -javaagent:/usr/local/tomcat/performance-agent.jar -Dcmdev.profiler.filters.path=/usr/local/tomcat/filters.properties"
70+
mvn -q clean install
71+
rootDir=$PWD
72+
pushd test-app
73+
mvn -q clean install
74+
docker build -t test-app-tomcat -f Dockerfile-Tomcat9jdk17 .
75+
docker run -p 8080:8080 -p 8090:8090 -p 8787:8787 \
76+
-e JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS}" \
77+
-v $rootDir/test-app/filters.properties:/usr/local/tomcat/filters.properties \
78+
-v $rootDir/target/performance-agent.jar:/usr/local/tomcat/performance-agent.jar \
79+
-v $rootDir/test-app/traces:/tmp/traces \
80+
test-app-tomcat
81+
popd
82+
```
83+
84+
### Wildfly 28.0.0.Final-jdk17
85+
```bash
86+
export MSYS_NO_PATHCONV=1
87+
JAVA_TOOL_OPTIONS=" -javaagent:/opt/jboss/wildfly/performance-agent.jar -Dcmdev.profiler.filters.path=/opt/jboss/wildfly/filters.properties"
88+
mvn -q clean install
89+
rootDir=$PWD
90+
pushd test-app
91+
mvn -q clean install
92+
docker build -t test-app-wildfly -f Dockerfile-Wildfly .
93+
docker run -p 8080:8080 -p 8090:8090 -p 8787:8787 \
94+
-e JAVA_OPTS="${JAVA_TOOL_OPTIONS}" \
95+
-v $rootDir/test-app/filters.properties:/opt/jboss/wildfly/filters.properties \
96+
-v $rootDir/target/performance-agent.jar:/opt/jboss/wildfly/performance-agent.jar \
97+
-v $rootDir/test-app/traces:/tmp/traces \
98+
test-app-wildfly
99+
popd
100+
```
101+
54102
## License & Contributions
55103
Open source project – contributions and feedback are welcome!
56-
57-
## Third-party libraries
58-
59-
This project uses [ByteBuddy](https://bytebuddy.net/) for runtime instrumentation of Java classes and methods.
60-
61-
ByteBuddy is licensed under the Apache License, Version 2.0. You can find the full license text at: https://www.apache.org/licenses/LICENSE-2.0
62-
63-
By using ByteBuddy, this project complies with the terms of the Apache License 2.0, including attribution and license notice.

TESTS.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)