-
Notifications
You must be signed in to change notification settings - Fork 208
Start up time improvement with a limited number of CPU cores (experimental)
This feature is experimental and available from Application Insights 3.4.6.
First, create a jvm-disable-c2.json file with the following content:
[
{
match: [
"*::*"
],
c2: {
Exclude: true
}
}
]
After that, add -XX:+UnlockDiagnosticVMOptions -XX:CompilerDirectivesFile=jvm-disable-c2.json -Dapplicationinsights.experiment.clear-compiler-directives-after-initialization=true to your JVM configuration.
An example with a Dockerfile:
COPY jvm-disable-c2.json jvm-disable-c2.json
CMD ["java", "-javaagent:/agents/applicationinsights-agent-3.4.6.jar", "-XX:+UnlockDiagnosticVMOptions", "-XX:CompilerDirectivesFile=jvm-disable-c2.json", "-Dapplicationinsights.experiment.clear-compiler-directives-after-initialization=true", "-jar", "/app.jar"]
You should see 1 compiler directives added in the standard output.
-Dapplicationinsights.experiment.clear-compiler-directives-after-initialization=true property. Without this, your application may become slow.
You can measure the agent initialization time from the JVM running for part of the following log type:
INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.4.6 started successfully (PID 3196, JVM running for 10.496 s).
You can do this with and without this feature and compare the results.