question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Boot Container takes up to 4x longer with APM agent

See original GitHub issue

We are deploying dockerized spring boot apps to Amazon ECS.

With the APM agent enabled, it takes up to 4x longer to start the application.

Without APM agent:

Started ReportingApplicationKt in 17.294 seconds (JVM running for 18.426)

With APM Agent:

Started ReportingApplicationKt in 68.718 seconds (JVM running for 72.722)

Spring Boot Version 2.1.x (latest) Kotlin Version 1.3.41 (latest) Docker Version 18.06 APM Agent Version 1.8 APM Server Version 7.3

Dockerfile

FROM openjdk:11-jre-slim

ADD https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem /root/.postgresql/root.crt

COPY build/libs/reporting-service-1.0-SNAPSHOT.jar app.jar
COPY elastic-apm-agent-1.8.0.jar apm-agent.jar
COPY run.sh run.sh

RUN chmod 777 run.sh

EXPOSE 8080

CMD ./run.sh

run.sh with APM enabled

#!/bin/bash

env=${SPRING_PROFILES_ACTIVE}

java \
-javaagent:apm-agent.jar \
-Delastic.apm.service_name=reporting-service \
-Delastic.apm.environment=${env} \
-Delastic.apm.server_urls=https://xy.apm.eu-central-1.aws.cloud.es.io:443 \
-Delastic.apm.application_packages=de.ottonow.xy \
-Delastic.apm.secret_token=xy \
-jar app.jar

run.sh without APM

#!/bin/bash

java \
-jar app.jar

The APM integration works and we retreive data, but the additional startup time is unbearable right now.

Any help is appreciated. If you need further information, please let me know.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kevcodezcommented, Aug 4, 2019

@eyalkoren Performance greatly increased with the snapshot, thanks for solving it so quickly.

0reactions
eyalkorencommented, Aug 4, 2019

@kevcodez not exactly a “bug”- whenever we apply any instrumentation, we need to look at the classes as they are loaded into the JVM and decide whether we need to instrument them or not. We normally try to filter as much as possible by doing light matching for all classes and heavy matching only on the minimal subset that passes the filters. I added such filtering now to this specific instrumentation.

Please unzip this snapshot agent build and use it instead of the agent you currently use, without the -Delastic.apm.disabled_instrumentations setting. If you leave this configuration, you won’t get your Apache HttpClient calls traced.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Monitoring - TechDocs
Spring Boot Monitoring provides extended visibility into Spring Boot ... The agent reports Spring Boot thread dump endpoint metrics per thread as.
Read more >
Java Agent version 1.x | APM Java Agent Reference [master]
It only impacts prefix patterns due to the additional context path in pattern. It does not impact deployment within the ROOT context like...
Read more >
How to Integrate Elastic APM Java Agent with Spring Boot
Elastic APM provides an easy way to monitor Spring Boot applications. ... Within the container context, you could run the agent as a...
Read more >
How to monitor Spring Boot apps with Elastic APM Java Agent
In this article · Prerequisites · Deploy the Spring Petclinic application · Enable custom persistent storage for Azure Spring Apps · Activate ...
Read more >
Java Supported Environments - AppDynamics Documentation
The AppDynamics Java Agent uses the standard JVM Tool Interface (JVMTI) ... Open Source, Spring WebFlux, 5.0, 5.1, 5.2, 5.3, HTTP, Yes, Spring...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found