microsoft / ApplicationInsights-Java

Application Insights for Java
http://aka.ms/application-insights
Other
296 stars 199 forks source link

Question: Memory CPU Requirements #2014

Open btthorstenwitt opened 2 years ago

btthorstenwitt commented 2 years ago

Hello,

I want to use the Java agent inside of one docker container together with our Java SpringBoot application, like this way:

java -Xmx1024m
  -javaagent:/home/myapp/applicationinsights-agent.jar \
  -jar \
  myapp.jar

I recognized that the startup of the Java SpringBoot application is much slower, when I pass the -javaagent argument.

So I would like to ask how much memory and cpu the agent will consume, when my app is under load? And maybe another stupid question: Will the javaagent use the memory of the allocated memory of the Xmx1024 argument or will it allocate memory from another pool?

Thank you for your help

Regards

Thorsten

nik-lazer commented 2 years ago

Not sure that I can fully answer the question, but I did some research here and can share some findings. I was interested, how much overhead can be with using Azure Insights monitoring and I could not do it on real business application under the load, but completed the tests on simple Spring Boot application with Web and Actuator on board. My idea was that even such artificial test can be valuable, because measurements for test application cannot be worse then for real application under the load - more load - more metrics.

As a result I got the following summary: Heap consumption (max) Non-heap consumption (max) Comments
Simple Spring Boot application ~30 MB ~60 MB
The application + AI agent ~150 MB ~105 MB AI agent give 100-120 MB overhead for Heap and 50-60 MB in non-heap
The application with AI as a dependency (old approach) ~80 MB ~75 MB Old AI approach gives overhead ~50 MB for Heap and 15 MB for non-heap

Jconsole measurements for the Spring Boot Application without monitoring

Jconsole measurements for the Spring Boot Application with monitoring via AI agent

Jconsole measurements for the Spring Boot Application with monitoring via old AI approach

Outcomes for me were that memory overhead is significant and has to be taken into account when memory limits are configured.