ApplicationInsights-Java icon indicating copy to clipboard operation
ApplicationInsights-Java copied to clipboard

Question: Memory CPU Requirements

Open btthorstenwitt opened this issue 2 years ago • 1 comments

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

btthorstenwitt avatar Dec 15 '21 10:12 btthorstenwitt

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

  • heap изображение

  • non-heap изображение

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

  • heap изображение

  • non-heap изображение

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

  • heap изображение

  • non-heap изображение

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

nik-lazer avatar Feb 18 '22 09:02 nik-lazer