-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Startup impact of application insight on microservices startup #2000
Comments
any update? |
hi @Sachin1O1, it depends a lot on the application and the compute resources. there's also additional overhead on Java 8 because the agent jar is signed, and the Java JIT compiler is not activated until later on in the startup process on Java 8 (this is not an issue on Java 11). |
Hi @trask , I have some stats on how my service startup time is impacted by the application insight jar Service startup sample
Container resources resources: Java Java 11 (OpenJ9) As you can see it inc startup time by almost X2 |
I'm curious to know which version of agent were you testing against? Did you try the latest GA/BETA version? |
Hi @heyams, I am using Application Insights Java 3.2.4 (GA) |
i'm working on a debug startup profiler.. so that you can provide thread dump to us for further debugging. we're not able to repro it. |
@Sachin1O1 can you use this 3.2.6-BETA-SNAPSHOT and help us collect thread dump from your app? Please set Let it run till your app has started. Then send me ([email protected]) the file called stacktrace.txt located in your temp folder. The full path is available in the applicationinsights.log. Something like |
@Sachin1O1 i updated the snapshot link above. earlier version was no good. please give it a try and get back to us when you can. thanks. |
@heyams Thanks for the profiler. I will update you with the relevant data ASAP. :) |
Hi @heyams, we did some testing with the StartupProfiler, and we will share the stacktrace.txt with you on e-mail. But we encountered a warning and one exception. First was the warning that InstrumentationKey is missing.
I was looking at the code, Lines 65 to 67 in a829ca9
And it seems to originate here: Line 106 in a829ca9
Not sure if I'm in the correct place, but we haven't used the The other was a NPE capture thread dump method. Exception in thread "StartupProfiler" java.lang.NullPointerException
at com.microsoft.applicationinsights.agent.StartupProfiler$ThreadDump.captureThreadDump(StartupProfiler.java:106)
at com.microsoft.applicationinsights.agent.StartupProfiler$ThreadDump.run(StartupProfiler.java:90)
at java.base/java.lang.Thread.run(Thread.java:829) At first glance I was unable to figure out if this case was handled, so I'm not sure if the thread dump exited prematurely. |
we fixed the following warning in 3.2.6 GA. Please try 3.2.6 GA. StartupProfiler is available in that release as well. |
i also double checked the NPE iin StartupProfiler.. it's inside a for loop. i definitely recommend you trying out the 3.2.6 GA version and let us know how it goes. thanks. |
Hi @heyams, We used the latest version 3.2.6 GA. and the code snippet shared was from the latest code. |
can you share your applicationinsights.log and applicationinsights.json with me at [email protected]? |
Hi @heyams I can share it here mycontainer:$ ls |
@Sachin1O1 you don't have a connection string? or you omitted it on purpose because sharing it publicly here? can you email me the applicationinsights.log? |
Sure, @trask. Can you let me know what type of changes we have submitted in this snapshot to improve startup? |
sure! primarily: open-telemetry/opentelemetry-java-instrumentation#5724 and further we are disabling jax-rs annotation instrumentation by default in our distro (Application Insights) since we do not capture INTERNAL spans by default which is all that the jax-rs annotation instrumentation captures, and as noted in [the opentelemetry PR](open-telemetry/opentelemetry-java-instrumentation#5724, the jax-rs annotation instrumentation is a further type matching drag on startup performance |
Hi @trask, Are these changes now available in the released version? |
yes, available in 3.3.0-BETA, let us know if you see any improvement |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Hi @trask, we are still facing a high resource usage issue with the Application insight jar at the startup. We tweaked the resources for microservices but a still big chunk of our application is still a monolith and demands more resources than microservices. Earlier there was a startup time of 2 min but as soon we migrated the monolith into the spring boot project we see a large impact on the startup by Application insight jar. Startup time observation: Without jar 40 to 50 sec Allocated resources "resources": { It looks like the agent is CPU demanding as I increased the CPU limit to 1500m its reduce startup time by half. |
@trask any update on this :) |
hi @Sachin1O1! there's been another optimization upstream that may help (open-telemetry/opentelemetry-java-instrumentation#6286), it will be included in the next upstream release that is going out this week, and then we will pull it into Application Insights and we can see what kind of impact it has for you |
Hi @trask , can you please clear the impact and if we can use dynamic attach of the agent. |
yes, this is supported from 3.3.0, check out https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-spring-boot (which also mentions the limitations) |
Hi @trask , |
oh yes, this is correct:
|
Hi @Sachin1O1 and @kbjerke, We have developed an experimental feature to improve the start-up time of Application Insights and reduce the CPU usage during Application Insights initialization, in the case of a limited number of CPU cores. The feature is documented here. We would like your feedback on this feature if you could test it. |
Hi @jeanbisutti , Thank you for informing us about this feature. We will surely try this and update you with the results. |
I'm glad I found this issue. It gave me a way to fix my issue with app insights causing my service, Keycloak, to be unstable when deployed in AKS. It was failing liveness probes at startup after I enabled the agent. Adding a 60 second initial delay to the probe fixed my issue. |
There is a known issue with Java 8 that can increase the start-up time with Application Insights. If you use Java 8, you can try:
Otherwise, you could try this experimental feature. |
Here's the version info output by the agent:
Keycloak uses Quarkus, not Spring Boot. I considered using the experimental feature, but I'm OK with a slow startup for now. If you need beta testing of the feature, I'd be willing to give it a go. I'm also wondering if OpenJDK is the issue. |
@carlin-q-scott You use AKS. You may have configured a limited number of CPU cores. The agent initialization can trigger the JVM C2 compiler that may use a lot of the limited CPU cores during the startup. We will be glad to have feedback about this experimental feature! |
What's the minimum / maximum startup impact of application insight on microservices startups?
The text was updated successfully, but these errors were encountered: