dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

High Startup Resources

Open sidhant92 opened this issue 2 years ago • 2 comments

Hi, I am trying to deploy Micronaut v3.5.4 to production. What I noticed is, that when I try to directly run the jar it takes about ~700 ms to startup and around ~25% CPU when given a single core. But the same changes to ~1800ms and 300% CPU when starting the same jar with datadog-java agent. Is this really expected because it is beating the purpose of fast startups and low resources overhead?

sidhant92 avatar Aug 08 '22 08:08 sidhant92

The used memory just after bootup is also significantly more

sidhant92 avatar Aug 08 '22 12:08 sidhant92

Hi @sidhant92 the tracer does need to use CPU and heap during startup (and warmup of the application) to analyse which classes to instrument for tracing purposes. We are looking at ways to reduce this overhead and I'll update this issue when we have something you can test.

mcculls avatar Sep 09 '22 14:09 mcculls

The 1.14.0 release contains a number of startup improvements that could help here

mcculls avatar May 15 '23 10:05 mcculls

Startup overhead was reduced by https://github.com/DataDog/dd-trace-java/pull/5026 - this feature also lets you persist type-matching data using DD_RESOLVER_CACHE_DIR=<writable-directory> which means less overhead when restarting.

There have been further minor improvements since then, I recommend trying the latest release 1.20.0

mcculls avatar Aug 31 '23 10:08 mcculls