elastic / elastic/apm-agent-java

STARTUP TUNING: Further startup speedups

Open
#2,463 1 comment 0 reactions 0 assignees View on GitHub
agent-java
Dominant language
Java
Stars
594
Forks
338
Avg merge
1d 13h
Merged PRs (30d)
25

Description

## Is your feature request related to a problem?
Synchronous startup would ideally be faster for some types of apps (eg serverless functions)

## Describe the solution you'd like
Speedup or spin into other threads anything on the synchronous startup path

## Describe alternatives you've considered
See https://github.com/elastic/apm-agent-java/issues/2349

## Additional context
The following shows a basic synchronous startup (at time of agent version 1.29.0, for an agent with no instrumentations applied) with time broken down into major sections and some some suggested possible improvements

Agent step | % time taken | Suggested improvement
-- | -- | --
from JVM initialization to ElasticApmAgent class initialization | 12.27% | Can't improve
from class initialization to initialize() | 1.23% | Can't improve
get config sources | 1.23% | statically generate?
LoggingConfiguration.init | 6.75% | Issue #2457
getLogger() - ie the rest of the logging framework initialization | 20.25% | Issue #2457
setup default config registry | 3.68% | statically generate?
new ApmServerClient | 2.45% | Spin off to another thread?
new MetaData | 0.92% | statically generate?
new ReporterFactory | 2.15% | make lazy?
new ElasticApmTracer | 1.53% | make lazy?
DependencyInjectingServiceLoader.load(LifecycleListener) | 4.91% | statically generate?
DependencyInjectingServiceLoader.load(ElasticApmInstrumentation) | 14.11% | statically generate?
new ByteBuddy | 2.45% |  
new AgentBuilder | 16.56% | Applying instrumentations, so only byte buddy can make this faster - but warmup can be speeded up?
applyAdvices | 0.00% | dependent on instrumentation configured
agentBuilder.installOn (includes matching, applying advice, warmup) | 7.36% | dependent on instrumentation configured
start tracer | 2.15% | dependent on instrumentation configured

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.