Microsoft Azure Open Source Development Support Team Blog

Support for Open Source Technologies on Microsoft Azure App Service

Profiling Java process on Azure web apps

There are certain situations when your Java web application is not performing as you expect it to. To understand where the problem lies, you may need to profile your application and understand its behavior for different flows.

Azure App Service environment being a sandbox environment, does not support to install JProfiler and not even expose the JMX information, which can be read by Jconsole to profile your application. The way to profile you application on Azure App Service environment is by using the New Relic tool.

Follow these steps –

1. Create a New Relic APM account on Azure portal.

New Relic account

New Relic account

Make sure you select at least the Small Pro in the pricing tier.

2. Open the New Relic APM and click on the View at New Relic link as highlighted.

View at New Relic

View at New Relic

3. Click on Browser and Install a New Relic APM agent.

New Relic Java agent

New Relic Java agent

4. Select “Java” and then Download the Java agent mentioned at step 2.

5. Unzip the downloaded file and copy the newrelic folder to your wwwroot folder or any folder within your application.

newrelic folder

newrelic folder

6. Add the Application Settings for CATALINA_OPTS in your webapp on Azure Portal with value as
-Djavaagent:”D:\home\site\wwwroot\newrelic\newrelic.jar”.
Make sure you modify the path accordingly.

App Setting for Catalina options

App Setting for Catalina options

7. Once your website is accessed, you should see the JVM listed on your New Relic Dashboard.

New Relic Dashboard with JVMs info

New Relic Dashboard with JVMs info

8. Using the Profile JVM link, you can profile your Java process and take thread dumps.

JVM Information

JVM Information

Sample Profiled data

Tree View for Profiled data

Tree View for Profiled data

Hope this helps you debugging issues with your webapp!