|
| 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. |
0 commit comments