Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Spring Boot application takes too long to initialize with th

Moderators: Vladimir Kondratyev, Anton Katilin

Spring Boot application takes too long to initialize with th

Postby maseev » Mon Jul 23, 2018 7:26 pm

Hi.

I've got a Spring Boot application which I run inside a Docker container. The problem is, it takes too long for the application to fully initialize.

For example, when I run the application inside the Docker container without the YourKit Java agent attached to it, it takes approximately 1 minute to initialize and start accepting requests from users.
However, when I run the very same application with the YourKit Java agent attached to it, it takes 10 minutes to start. This particular problem manifests itself only in the container environment.

I used the YourKit guide in order to setup the Java agent inside a Docker container, but it seems to me there's something else going on. Unfortunately, I wasn't able to see any problems in the agent log. It looks pretty normal to me.

Is there anything I can do to find out what slows down the application with the agent attached to it?

Thanks.
maseev
 
Posts: 4
Joined: Sat Jul 21, 2018 4:43 pm

Re: Spring Boot application takes too long to initialize wit

Postby maseev » Tue Jul 24, 2018 3:15 am

maseev
 
Posts: 4
Joined: Sat Jul 21, 2018 4:43 pm

Re: Spring Boot application takes too long to initialize wit

Postby Anton Katilin » Tue Jul 24, 2018 6:23 am

Hi,

There is nothing odd in the log.

Please note you run with the debugger too (-agentlib:jdwp). Please check if the problem is reproducible without -agentlib:jdwp.

Please try the agent startup options recommended by the EE server integration wizard:

-agentpath:<path to agent>=port=<port>,listen=all,disablestacktelemetry,exceptions=disable

Does this help?

Best regards,
Anton
Anton Katilin
 
Posts: 5826
Joined: Wed Aug 11, 2004 8:37 am

Re: Spring Boot application takes too long to initialize wit

Postby maseev » Thu Jul 26, 2018 5:18 pm

Anton Katilin wrote:Hi,
Please note you run with the debugger too (-agentlib:jdwp). Please check if the problem is reproducible without -agentlib:jdwp.


Yes, it's reproducible without the remote debugger agent attached to the JVM. The interesting thing is when I leave the jdwp agent connected to the JVM and add the "disablestacktelemetry,exceptions=disable" options to the YourKit Java agent, the startup time drops from 10 minutes to 2.
If I remove the jdwp agent and leave only the YourKit Java agent with these options "disablestacktelemetry,exceptions=disable" the application takes only 1 minute to start.

Anton Katilin wrote:Please try the agent startup options recommended by the EE server integration wizard:

-agentpath:<path to agent>=port=<port>,listen=all,disablestacktelemetry,exceptions=disable

Does this help?


Actually, yes, it does help. Now the application takes a little bit more than a minute to fully initialize (without jdwp agent though).

Although, I'm a little bit worried whether it's a good idea to disable stack telemetry altogether. The documentation says that this information can potentially be very useful in the debugging process. If I understand correctly, I won't be able to turn this feature back on using YourKit profiler.

And what about this option - "exceptions=disable"? Can I use "exceptions=off" instead of "disable" so I'd be able to turn this feature on at runtime via YourKit profiler connected to the app? I'm not really sure that's a good idea to disable this feature completely.
maseev
 
Posts: 4
Joined: Sat Jul 21, 2018 4:43 pm

Re: Spring Boot application takes too long to initialize wit

Postby Anton Katilin » Thu Jul 26, 2018 6:32 pm

Hi,

I won't be able to turn this feature back on using YourKit profiler.

It's not true. You can turn stack telemetry on and off in runtime when you want, with the toolbar button in the profiler UI or programmatically:
https://www.yourkit.com/docs/java/help/threads.jsp

And what about this option - "exceptions=disable"? Can I use "exceptions=off" instead of "disable" so I'd be able to turn this feature on at runtime via YourKit profiler connected to the app? I'm not really sure that's a good idea to disable this feature completely.

Please try "exceptions=off". Normally, the overhead should not be significant.

Best regards,
Anton
Anton Katilin
 
Posts: 5826
Joined: Wed Aug 11, 2004 8:37 am

Re: Spring Boot application takes too long to initialize wit

Postby maseev » Fri Jul 27, 2018 2:41 am

Anton Katilin wrote:It's not true. You can turn stack telemetry on and off in runtime when you want, with the toolbar button in the profiler UI or programmatically:
https://www.yourkit.com/docs/java/help/threads.jsp


Oh, I see. I forgot about this button completely. Well, that's great. I guess it's not a big deal to have stack telemetry disabled from the start because I can always turn it back on from YourKit profiler. The only thing is that I won't have any "historical" data about stack telemetry unless I enable this feature from profiler by clicking on that button you mentioned before.

Anton Katilin wrote:Please try "exceptions=off". Normally, the overhead should not be significant.


Sure, I already did. It works perfectly.

Thank you for your help, Anton.

Have a great day.
maseev
 
Posts: 4
Joined: Sat Jul 21, 2018 4:43 pm


Return to Java Profiler

Who is online

Users browsing this forum: Google [Bot] and 17 guests

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.