Skip to content

Commit 60c280c

Browse files
authored
Merge pull request #107 from SylvainJuge/doc-java-performance
doc add java instrumentation overhead
2 parents f26088c + ba442ce commit 60c280c

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

docs/_edot-sdks/java/migration.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ This documentation describes how to update applications that are currently using
2828

2929
## Migration steps
3030

31+
- review all pros/cons of this migration guide including the [differences in performance overhead](./overhead).
3132
- (optional) migrate usages of Elastic APM Agent API with OpenTelemetry API in the application source code.
3233
- remove the `-javaagent:` argument containing [Elastic APM Java agent](https://www.elastic.co/guide/en/apm/agent/java/current/index.html) from the JVM arguments
3334
- replace configuration options using [reference](#option-reference) below, see [configuration](./configuration) for ways to provide those.
3435
- add `-javaagent:` argument to the JVM arguments to use EDOT Java and restart the application or follow [Kubernetes instructions](./setup/k8s) if applicable.
3536
- there is currently no EDOT equivalent for starting the agent with the [remote attach](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-cli.html) capability. The `-javaagent:` option is the preferred startup mechanism.
36-
- there is a migration path for starting the agent with [self attach](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-api.html), which is to use [runtime attachment](https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/runtime-attach/README.md).
37+
- there is a migration path for starting the agent with [self attach](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-api.html), which is to use [runtime attachment](https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/runtime-attach/README.md).
3738

3839
## Option reference
3940

docs/_edot-sdks/java/overhead.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Performance overhead
3+
layout: default
4+
nav_order: 8
5+
parent: EDOT Java
6+
---
7+
8+
# Performance overhead
9+
10+
While it is designed to and usually have minimal performance overhead, the EDOT Java agent, like any instrumentation agent,
11+
executes within the application process and thus has a small influence on the application performance.
12+
13+
This extra performance overhead depends on the application's technical architecture, its configuration and environment and
14+
the load. Those factors are not something that are easy to reproduce on their own, and all applications are different so
15+
it is impossible to provide a simple answer like "+1% extra CPU time and +100Mb of memory".
16+
17+
The performance overhead on the JVM can be measured by the following high-level metrics:
18+
19+
- application startup time
20+
- application response time, which can be directly perceived by users
21+
- CPU usage
22+
- Garbage collector activity: more memory allocation means more GC activity, thus increasing overall CPU usage and potentially reducing application responsiveness
23+
- Memory usage: how much more memory (heap/non-heap) is needed
24+
25+
While we can't provide generically applicable, accurate numbers about the above, we execute synthetic benchmarks with a sample application
26+
which allows to provide an estimate, comparison between agents and an order of magnitude of the effective overhead.
27+
28+
Those numbers are only provided as indicators, and you should not attempt to extrapolate them. You should however use
29+
them as a framework to evaluate and measure the overhead on your applications.
30+
31+
For example, the application startup overhead going from 5s to 6s (+1s, +20%) does not mean an application having a startup time of
32+
15s will now start in 18s but that you can expect to have about at least one extra second of startup time and the overall
33+
impact remains limited.
34+
35+
The following table compares the *classic Elastic APM Java Agent* with the `EDOT Java Agent` and the same benchmark without an agent.
36+
37+
| | no agent | EDOT Java instrumentation | Elastic APM Java agent |
38+
|------------------------------|-----------|---------------------------|------------------------|
39+
| startup time | 5.55 s | 6.82 s | 6.87 s |
40+
| request latency (p95) | 1.96 ms | 2.06 ms | 2.08 ms |
41+
| total system cpu utilization | 53.82 % | 54.25 % | 56.92 % |
42+
| total allocated memory | 21.54 gb | 26.37 gb | 22.15 gb |
43+
| total GC pauses | 106 ms | 123 ms | 120 ms |
44+
| max heap used | 436.71 mb | 478.46 mb | 573.92 mb |
45+
46+
The main difference between the two agents is that unlike EDOT, Elastic APM Java agent recycles in-memory data
47+
structures which allows to reduce the overall allocated memory and thus reduces a bit the overhead on the garbage collector.
48+
49+
This difference is also the reason why we observe a difference in the maximum heap usage as more data structures are kept
50+
in-memory when possible and not recycled by the garbage collector. This however does not mean that Elastic APM Java agent _requires_
51+
about 100mb more of memory compared to EDOT, but that when there is no limitation on heap memory usage the agent will
52+
use available memory to minimize memory allocation.

docs/_edot-sdks/java/release.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Release Notes
33
layout: default
4-
nav_order: 8
4+
nav_order: 9
55
parent: EDOT Java
66
---
77

0 commit comments

Comments
 (0)