Application Insights for Java Applications: Triggering Profiling Sessions Automatically

Profiling applications can be a difficult and time-consuming process, but it is essential for understanding how an application is performing and where potential bottlenecks may exist.

During Microsoft Ignite, a new feature within Application Insight was announced, which aims to make collecting profiling information for java applications much easier.

To access the feature, navigate to the “Performance” section within Application insight. Next click on the “Profiler” button.

Within this view, you can setup automatic collection of profiling information by a specific CPU or Memory Threshold. This can be very valuable when some strange behaviour is observed exclusively in production during specific time periods, or when trying to track down why an application is slower during certain times of day. You can also manually start a profiling session directly through the portal.

Once Application Insight has collected profiling data, you can download a JFR file for further analysis. One of the tools available is VisualVM. Now you can drill-down to identify what methods are taking the longest to execute:

The data can also be used to get a better understanding about the Socket IO activity:

To use this preview feature, you’ll have to meet the following prerequisites:

  • Use Application Insights Agent verson 3.4.1 or higher
  • Use Java 8 update 262+ or Java 11+
  • Opting-in to this preview feature by setting the env variable APPLICATIONINSIGHTS_PREVIEW_PROFILER_ENABLED=true

For more information on how to use this new feature, please check out the following documentation: Java Profiler for Azure Monitor Application Insights — Azure Monitor | Microsoft Learn

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aymen Furter

I am a Cloud Solution Architect working for Microsoft. The views expressed on this site are mine alone and do not necessarily reflect the views of my employer.